commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Neidhart <thomas.neidh...@gmail.com>
Subject Re: svn commit: r1447443 - in /commons/proper/codec/trunk/src: changes/ main/java/org/apache/commons/codec/binary/
Date Mon, 18 Feb 2013 20:25:29 GMT
On 02/18/2013 08:14 PM, julius@apache.org wrote:
> Author: julius
> Date: Mon Feb 18 19:14:31 2013
> New Revision: 1447443
> 
> URL: http://svn.apache.org/r1447443
> Log:
> CODEC-166 - Base64 could be faster.
> 
> Added:
>     commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/ApacheModifiedMiGBase64.java
>     commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/MiGBase64.original
> Modified:
>     commons/proper/codec/trunk/src/changes/changes.xml
>     commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Base64.java

I played around with your benchmark, and the main reason Commons Codec
is so slow compared to the other ones is because CC initializes by
default an internal buffer with a fixed size of 8192.

Adjusting the BaseNCodec.encode(byte[]) / decode(byte[]) methods to
pre-initialize the internal buffer to a better estimate (array.length *
4 / 3 in the encode case, and array.length * 3 / 4 in the decode case)
results in very similar figures compared to MiGBase and iHarder.

So I would be in favor of reverting this change and improve the existing
Base64 implementation, I can provide a patch for this.

Thomas



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message