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 6F401460E for ; Thu, 7 Jul 2011 16:35:39 +0000 (UTC) Received: (qmail 76429 invoked by uid 500); 7 Jul 2011 16:35:39 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 76384 invoked by uid 500); 7 Jul 2011 16:35:38 -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 76376 invoked by uid 99); 7 Jul 2011 16:35:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Jul 2011 16:35:38 +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; Thu, 07 Jul 2011 16:35:37 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id CAEF34BC24 for ; Thu, 7 Jul 2011 16:35:16 +0000 (UTC) Date: Thu, 7 Jul 2011 16:35:16 +0000 (UTC) From: "Paul Loy (JIRA)" To: commits@cassandra.apache.org Message-ID: <1585099043.8080.1310056516827.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <129905965.36228.1308909407388.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (CASSANDRA-2820) Re-introduce FastByteArrayInputStream (and Output equivalent) 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/CASSANDRA-2820?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul Loy updated CASSANDRA-2820: -------------------------------- Attachment: fast_bytearray_iostreams_harmony-patch-4.txt More like my original: * extends Input/OutputStream * change uses of ByteArrayInputStream to use InputStream * uses of ByteArrayOutputStream have to now know they are using FastByteArrayOutputStream as that has the #toArray() method. > Re-introduce FastByteArrayInputStream (and Output equivalent) > ------------------------------------------------------------- > > Key: CASSANDRA-2820 > URL: https://issues.apache.org/jira/browse/CASSANDRA-2820 > Project: Cassandra > Issue Type: Improvement > Components: Core > Affects Versions: 0.8.0 > Environment: n/a > Reporter: Paul Loy > Priority: Minor > Labels: bytearrayinputstream, bytearrayoutputstream, license, synchronized > Fix For: 1.0 > > Attachments: fast_bytearray_iostreams_harmony-patch-2.txt, fast_bytearray_iostreams_harmony-patch-3.txt, fast_bytearray_iostreams_harmony-patch-4.txt > > > In https://issues.apache.org/jira/browse/CASSANDRA-37 FastByteArrayInputStream and FastByteArrayOutputStream were removed due to being code copied from the JDK and then subsequently modified. The JDK license is incompatible with Apache 2 license so the code had to go. > I have since had a look at the performance of the JDK ByteArrayInputStream and a FastByteArrayInputStream (i.e. one with synchronized methods made un-synchronized) and seen the difference is significant. > After a warmup-period of >10000 loops I get the following for 10000 loops through a 128000 byte array: > bais : 3513ms > fbais: 72ms > This varies depending on the OS, machine and Java version, but it's always in favour of the FastByteArrayInputStream as you might expect. > Then, at Jonathan Ellis' suggestion, I tried this using a modified Apache Harmony ByteArrayInputStream - i.e. one whose license is compatible - and the results were the same. A significant boost. > I will attach a patch with changes for the 0.8.0 tag. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira