Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 53F60D4E3 for ; Mon, 18 Feb 2013 19:17:13 +0000 (UTC) Received: (qmail 63980 invoked by uid 500); 18 Feb 2013 19:17:13 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 63901 invoked by uid 500); 18 Feb 2013 19:17:13 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 63891 invoked by uid 99); 18 Feb 2013 19:17:13 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Feb 2013 19:17:13 +0000 Date: Mon, 18 Feb 2013 19:17:12 +0000 (UTC) From: "Julius Davies (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (CODEC-166) Base64 could be faster 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/CODEC-166?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Julius Davies resolved CODEC-166. --------------------------------- Resolution: Fixed Fix Version/s: 1.8 Marking as "fixed" for now.... curious what others think. > 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 > Fix For: 1.8 > > Attachments: base64bench.zip, CODEC-166.draft.patch, CODEC-166.patch > > > Our Base64 consistently performs 3 times slower compared to MiGBase64 and iHarder in the byte[] and String encode() methods. > We are pretty good on decode(), though a little slower (approx. 33% slower) 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 valid 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 String 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 streaming 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 administrators For more information on JIRA, see: http://www.atlassian.com/software/jira