Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D65D564F2 for ; Fri, 29 Jul 2011 15:38:34 +0000 (UTC) Received: (qmail 41250 invoked by uid 500); 29 Jul 2011 15:38:34 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 41125 invoked by uid 500); 29 Jul 2011 15:38:34 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 41089 invoked by uid 99); 29 Jul 2011 15:38:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Jul 2011 15:38:34 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,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, 29 Jul 2011 15:38:32 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 9731B94C35 for ; Fri, 29 Jul 2011 15:38:10 +0000 (UTC) Date: Fri, 29 Jul 2011 15:38:10 +0000 (UTC) From: "Sylvain Lebresne (JIRA)" To: commits@cassandra.apache.org Message-ID: <364815493.18902.1311953890616.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <2124532481.862.1309710201869.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Issue Comment Edited] (CASSANDRA-2850) Converting bytes to hex string is unnecessarily slow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CASSANDRA-2850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072867#comment-13072867 ] Sylvain Lebresne edited comment on CASSANDRA-2850 at 7/29/11 3:37 PM: ---------------------------------------------------------------------- +1, committed, thanks. I've slightly updated the patch so that we use a copying String constructor in case using the package-protected one fails. Since it's not part of the public API, it avoids potential bug with some JDK that wouldn't have this constructor (I'm attaching the committed patch for the record). was (Author: slebresne): +1, committed, thanks. I've slightly updated the patch so that we use a copying String constructor in case using the package-protected one fails. Since it's not part of the public API, it avoids potential bug with some JDK that wouldn't have this constructor. > Converting bytes to hex string is unnecessarily slow > ---------------------------------------------------- > > Key: CASSANDRA-2850 > URL: https://issues.apache.org/jira/browse/CASSANDRA-2850 > Project: Cassandra > Issue Type: Improvement > Components: Core > Reporter: David Allsopp > Assignee: David Allsopp > Priority: Minor > Fix For: 0.8.3 > > Attachments: 2850-rebased.txt, 2850-v2.patch, 2850-v4.patch, 2850-v4a.patch, 2850-v5.patch, 2850-v6_08.patch, BytesToHexBenchmark.java, BytesToHexBenchmark2.java, BytesToHexBenchmark3.java, cassandra-2850a.diff > > > ByteBufferUtil.bytesToHex() is unnecessarily slow - it doesn't pre-size the StringBuilder (so several re-sizes will be needed behind the scenes) and it makes quite a few method calls per byte. > (OK, this may be a premature optimisation, but I couldn't resist, and it's a small change) > Will attach patch shortly that speeds it up by about x3, plus benchmarking test. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira