Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63398100C9 for ; Tue, 14 Jan 2014 09:09:09 +0000 (UTC) Received: (qmail 38779 invoked by uid 500); 14 Jan 2014 09:07:25 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 38744 invoked by uid 500); 14 Jan 2014 09:07:20 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 38632 invoked by uid 99); 14 Jan 2014 09:07:06 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jan 2014 09:07:06 +0000 Date: Tue, 14 Jan 2014 09:07:06 +0000 (UTC) From: "Hudson (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-10320) Avoid ArrayList.iterator() ExplicitColumnTracker MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HBASE-10320?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13870546#comment-13870546 ] Hudson commented on HBASE-10320: -------------------------------- FAILURE: Integrated in HBase-0.94-JDK7 #29 (See [https://builds.apache.org/job/HBase-0.94-JDK7/29/]) HBASE-10320 Avoid ArrayList.iterator() ExplicitColumnTracker (larsh: rev 1557951) * /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/ExplicitColumnTracker.java > Avoid ArrayList.iterator() ExplicitColumnTracker > ------------------------------------------------ > > Key: HBASE-10320 > URL: https://issues.apache.org/jira/browse/HBASE-10320 > Project: HBase > Issue Type: Bug > Components: Performance > Reporter: Lars Hofhansl > Assignee: Lars Hofhansl > Fix For: 0.98.0, 0.96.2, 0.99.0, 0.94.17 > > Attachments: 10320-0.94-v2.txt, 10320-0.94-v3.txt, 10320-0.94-v4.txt, 10320-0.94.txt, 10320-trunk-v4.txt > > > 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 > {code} > private ArrayList l; > ... > for (int i=0; i X = l.get(i); > ... > } > {code} > Is twice as fast as: > {code} > private ArrayList l; > ... > for (X : l) { > ... > } > {code} > 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. > Edit: > {code} > private X[] l; > ... > for (int i=0; i X = l[i]; > ... > } > {code} > Is even better. Apparently the JVM can even save the boundary check in each iteration. -- This message was sent by Atlassian JIRA (v6.1.5#6160)