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 Tue, 19 Feb 2013 11:48:24 GMT
On 02/18/2013 11:18 PM, Julius Davies wrote:
> On Mon, Feb 18, 2013 at 2:08 PM, Gary Gregory <garydgregory@gmail.com> wrote:
>> How does this affect the B32 code and the common code w B64?
>>
>> Gary
>>
> 
> I tried to make sure the patch perturbed as little of the existing
> code as possible.   There are no changes to the B32 or shared logic.
> 
> Here's the colored diff of the only pre-existing file it touched
> (Base64.java).   The rest of the patch is new files:
> 
> http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Base64.java?r1=1435550&r2=1447443&diff_format=h
> 
> Some of the static encode/decode methods in Base64 changed.   I also
> re-introduced two instance methods.

ah, just as a side note when doing such micro-benchmarks:

you should always use the result in some way (e.g. use it in a
calculation), otherwise the JVM may optimize it away.

I changed the code to something like this:

        long d = 0;
        start = System.currentTimeMillis();
        for (int i = 0; i < FACTOR * REPS; i++) {
            encoded = IHarderBase64.encodeBytesToBytes(data);
            d += encoded[i % encoded.length];
        }
        printEncodeStat(start, data, d);

Thomas

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


Mime
View raw message