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 1C6AB10072 for ; Mon, 13 Jan 2014 05:23:06 +0000 (UTC) Received: (qmail 5015 invoked by uid 500); 13 Jan 2014 05:22:59 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 4985 invoked by uid 500); 13 Jan 2014 05:22:56 -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 4962 invoked by uid 99); 13 Jan 2014 05:22:51 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jan 2014 05:22:51 +0000 Date: Mon, 13 Jan 2014 05:22:51 +0000 (UTC) From: "Lars Hofhansl (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-10320) Avoid ArrayList.iterator() in tight loops 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=13869295#comment-13869295 ] Lars Hofhansl commented on HBASE-10320: --------------------------------------- bq. Where should we see the improvement overall? Scanning with ExplicitColumnTracker (i.e. a scan where some columns were added with addColumn) and where all/most data is filtered out at the server (by a filter or a coprocessor). So in PE the FilteredScanTest might do it. If you run that, let me know what you find. Might be that in all but extreme cases this is just in the noise. I think PE has relatively large columns (1000 bytes), so it might not show. Will wait with commit until we've had a PE test. > 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 > Attachments: 10320-0.94-v2.txt, 10320-0.94.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. -- This message was sent by Atlassian JIRA (v6.1.5#6160)