Changing AbstractList's iterator to track elements remaining rather than elements already returned.
On DRLVM, this results in a modest 10% runtime improvement in iteration. When I used -Xbootclasspath to run the current and new code on hotspot, the improvement was more pronounced. Runtimes are below; the benchmark results are below.
http://code.google.com/p/caliper/source/browse/trunk/test/com/google/caliper/examples/ListIterationBenchmarkSuite.java?spec=svn17&r=17
length vm ns logarithmic runtime
0 RI 20 |||||||||||
0 current 16 ||||||||||
0 new 14 ||||||||||
10 RI 63 ||||||||||||||||
10 current 82 |||||||||||||||||
10 new 45 ||||||||||||||
100 RI 393 |||||||||||||||||||||||
100 current 672 |||||||||||||||||||||||||
100 new 243 |||||||||||||||||||||
1000 RI 1191 |||||||||||||||||||||||||||
1000 current 2153 ||||||||||||||||||||||||||||||
1000 new 1294 ||||||||||||||||||||||||||||
git-svn-id: https://svn.apache.org/repos/asf/harmony/enhanced/classlib/trunk@889145 13f79535-47bb-0310-9956-ffa450edef68
1 file changed