Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 85E2AE872 for ; Wed, 30 Jan 2013 23:35:38 +0000 (UTC) Received: (qmail 99858 invoked by uid 500); 30 Jan 2013 23:35:38 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 99744 invoked by uid 500); 30 Jan 2013 23:35:38 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 99735 invoked by uid 99); 30 Jan 2013 23:35:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2013 23:35:37 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of sebbaz@gmail.com designates 74.125.82.170 as permitted sender) Received: from [74.125.82.170] (HELO mail-we0-f170.google.com) (74.125.82.170) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2013 23:35:33 +0000 Received: by mail-we0-f170.google.com with SMTP id z53so1743844wey.1 for ; Wed, 30 Jan 2013 15:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=m/XI3NjcMJ5H3bUKQYuuCybr02VYwxMOMc/vBlF+Oz0=; b=oCxfJKROmsb6guWIaXIFtB8zCqn0Lip4fU7lL5JnI9taSLcUdtbykB3WYy3311cXcG BzjTX3exsRKEg5Kj3/acyNyPgsmY7NfzB6tlhK74V58YW/emfRCUnim7Q3T3IEGxeR4X DCRFris63pJjBwMJuUohcXSR1+MwZlyoUdNDUFUu/1WGNr+zScXMsVdh7HJ4eB+gjnZc juDu78gx9Rg1VIhdMy3GxbiX6SNpCZNtnNBo5x42kU5Epz2uPx1TW8bmLbcFq25/LcNI u5tGaPeFOpuOB03Ca21QGydUaleTUGAHBzBblc0rW+n3ujCyKC8iEoX3pa8DcaKTsPAG RB+Q== MIME-Version: 1.0 X-Received: by 10.194.83.97 with SMTP id p1mr12068075wjy.17.1359588911805; Wed, 30 Jan 2013 15:35:11 -0800 (PST) Received: by 10.194.234.164 with HTTP; Wed, 30 Jan 2013 15:35:11 -0800 (PST) In-Reply-To: References: Date: Wed, 30 Jan 2013 23:35:11 +0000 Message-ID: Subject: Re: [jira] [Updated] (CODEC-166) Base64 could be faster From: sebb To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org The Fix version should only be added when the issue has been fixed, and should indicate the release in which the fix is available On 30 January 2013 23:33, Sebb (JIRA) wrote: > > [ https://issues.apache.org/jira/browse/CODEC-166?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] > > Sebb updated CODEC-166: > ----------------------- > > Fix Version/s: (was: 1.8) > >> Base64 could be faster >> ---------------------- >> >> Key: CODEC-166 >> URL: https://issues.apache.org/jira/browse/CODEC-166 >> Project: Commons Codec >> Issue Type: Bug >> Affects Versions: 1.7 >> Reporter: Julius Davies >> Assignee: Julius Davies >> Attachments: base64bench.zip >> >> >> Our Base64 consistently performs 3 times slower compared to MiGBase64 an= d iHarder in the byte[] and String encode() methods. >> We are pretty good on decode(), though a little slower (approx. 33% slow= er) than MiGBase64. >> We always win in the Streaming methods (MiGBase64 doesn't do streaming).= Yay! :-) :-) :-) >> I put together a benchmark. Here's a typical run: >> {noformat} >> LARGE DATA new byte[12345] >> iHarder... >> encode 486.0 MB/s decode 158.0 MB/s >> encode 491.0 MB/s decode 148.0 MB/s >> MiGBase64... >> encode 499.0 MB/s decode 222.0 MB/s >> encode 493.0 MB/s decode 226.0 MB/s >> Apache Commons Codec... >> encode 142.0 MB/s decode 146.0 MB/s >> encode 138.0 MB/s decode 150.0 MB/s >> {noformat} >> I believe the main approach we can consider to improve performance is to= avoid array copies at all costs. MiGBase64 even counts the number of val= id Base64 characters ahead of time on decode() to precalculate the result's= size and avoid any array copying! >> I suspect this will mean writing out separate execution paths for the St= ring and byte[] methods, and keeping them out of the streaming logic, since= the streaming logic is founded on array copy. >> Unfortunately this means we will diminish internal reuse of the streamin= g implementation, but I think it's the only way to improve performance, if = we want to. > > -- > This message is automatically generated by JIRA. > If you think it was sent incorrectly, please contact your JIRA administra= tors > For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org