commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@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 14:03:53 GMT
@TN: So... what is the performance difference as a %? The size of the input
must matter too...

Gary


On Tue, Feb 19, 2013 at 6:48 AM, Thomas Neidhart
<thomas.neidhart@gmail.com>wrote:

> 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
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message