| Summary: | redundant Strings created from Version.toString | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Equinox | Reporter: | Mark Stoodley <mstoodle> | ||||||
| Component: | Framework | Assignee: | equinox.framework-inbox <equinox.framework-inbox> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | hargrave, remy.suen, tjwatson | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | 3.7 M3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Mark Stoodley
Created attachment 178066 [details]
Modified version of Version.java
I've added a new private String field versionString and modified the code inside the toString() method to cache the String object built on the first invocation.
I am wondering why Version.toString() is getting called over and over so much. Is that coming from framework code or some other code in a bundle which is calling Version.toString so much? It does seem strange to call toString so much. It is possible this is use in creating descriptive strings from other object which aggregate a Version object. That is, the object's toString method calls Version.toString. I don't have an issue with updating Version for 4.3 to cache the resulting string. Created attachment 178079 [details]
Snapshot of call tree above Version.toString
Here's a snapshot of a call tree above the calls to Version.toString (sorry, much of class name has been stripped off these names by the tool, but hopefully still gives an idea of what's going on "upstairs").
Looks like the framework is at fault here. I see 24 places in the org.eclipse.osgi project where Version.toString is called. This does not include where Object.toString is called on a Version object. I updated the Version class in the OSGi companion code to cache the toString result. This will soon make its way into 3.7. The version class has been updated from OSGi for M3. The result of Version.toString is now cached. |