hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lars Hofhansl (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HBASE-10320) Avoid ArrayList.iterator() in tight loops
Date Sun, 12 Jan 2014 00:42:54 GMT
Lars Hofhansl created HBASE-10320:

             Summary: Avoid ArrayList.iterator() in tight loops
                 Key: HBASE-10320
                 URL: https://issues.apache.org/jira/browse/HBASE-10320
             Project: HBase
          Issue Type: Bug
          Components: Performance
            Reporter: Lars Hofhansl

I noticed that in a profiler (sampler) run ScanQueryMatcher.setRow(...) showed up at all.
In turns out that the expensive part is iterating over the columns in ExcplicitColumnTracker.reset().
I did some microbenchmarks and found that
private ArrayList<X> l;
for (int i=0; i<l.size(); i++) {
   X = l.get(i);
Is twice as fast than:
private ArrayList<X> l;
for (X : l) {

The indexed version asymptotically approaches the iterator version, but even at 1m entries
it is still faster.
In my tight loop scans this provides for a 5% performance improvement overall when the ExcplicitColumnTracker
is used.

This message was sent by Atlassian JIRA

View raw message