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 7DA3A49C3 for ; Fri, 27 May 2011 18:51:28 +0000 (UTC) Received: (qmail 16972 invoked by uid 500); 27 May 2011 18:51:28 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 16943 invoked by uid 500); 27 May 2011 18:51:28 -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 16935 invoked by uid 99); 27 May 2011 18:51:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 May 2011 18:51:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 May 2011 18:51:27 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 69A5DE3436 for ; Fri, 27 May 2011 18:50:47 +0000 (UTC) Date: Fri, 27 May 2011 18:50:47 +0000 (UTC) From: "stack (JIRA)" To: issues@hbase.apache.org Message-ID: <44837001.49504.1306522247429.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <215870810.49332.1306518467329.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HBASE-3928) Some potential performance improvements to Bytes/KeyValue 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-3928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13040376#comment-13040376 ] stack commented on HBASE-3928: ------------------------------ +1 on commit to TRUNK. Can only improve things. We'll be profiling 0.92 before commit so if a problem, a newly-introduced hotspot, we'll see it then (I'd doubt that this optimization would show in YCSB -- not unless it made stuff really bad, or really good which I don't think is going to be happening here). Odd we don't cache this Bytes.toBytes("MAX_SEQ_ID_KEY") and the other TIMERANGE constant that follows. > Some potential performance improvements to Bytes/KeyValue > --------------------------------------------------------- > > Key: HBASE-3928 > URL: https://issues.apache.org/jira/browse/HBASE-3928 > Project: HBase > Issue Type: Improvement > Affects Versions: 0.92.0 > Reporter: Todd Lipcon > Assignee: Todd Lipcon > Priority: Minor > Fix For: 0.92.0 > > Attachments: hbase-3928.txt > > > We use Bytes.compareTo() a lot where we could be using a more efficient equals() method. The trick that makes equals() faster than compareTo is that we can short-circuit two common cases: > Case 1) the length is not the same - only need to do one comparison > Case 2) the two arrays have the same length and a common prefix: compare the last byte first, since it's the one most likely to differ (given we are usually comparing adjacent sorted data). -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira