Summary: | Performance: long time spent in State.write(..) looping over ArrayList<char[][]> | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
Component: | Core | Assignee: | Kent Johnson <kent_johnson> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | Keywords: | performance |
Version: | 3.2 | ||
Target Milestone: | 3.2 M6 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Markus Keller
2006-02-15 05:32:09 EST
indexof is using == to do the comparison so unless the interned arrays are 100,000 elements then I doubt this the reason it was slow to save your workspace. java.util.ArrayList#indexOf(..) uses Object#equals(..) to find elements. I've set a breakpoint after the loop and that breakpoint was not hit for a long time, so I'm pretty sure the time was burned in this loop. I also suspended the vm manually, and it was inside indexOf(..) most of the time. I don't know how big qNames and sNames grow, but if I assume they contain just 1 element, then the number of calls to char[]#equals(..) is in average: references.elementSize * 2 * (internedQualifiedNames.size + internedSimpleNames.size) / 2 = 46'465'792 calls What does equals do for a char[] -> == I have no idea what you think that expression meant. > What does equals do for a char[] -> ==
Of course, but there are still (rough guess) more than 46 Million calls to an equals method. And that is a lot, even if they were plain == operations.
Fixed. Will have a big impact on very large projects. Verified for 3.2 M6 using warm-up build I20060327-0010. Unfortunately, close workspace operation does not long enough on our full source workspace to add a specific performance test case... |