Review/comment needed for the new public java.util.Base64 class
Xueming Shen
xueming.shen at oracle.com
Sat Oct 13 17:21:47 UTC 2012
With moving some code piece around (moved those lookup table into
En/Decoder)
and some array access code tuning (with the hope of eliminating the
array boundary
access) in encode0(), it appears the hotspot now can better optimize the
decoder
loop for the -server mode for encoding. decode0 also get 10% +boost with
simply
moving in the lookup table.
The latest version is at (decode0() vs decode1())
http://cr.openjdk.java.net/~sherman/4235519/Base64.java
The latest scores is at
http://cr.openjdk.java.net/~sherman/4235519/score2
(compared to http://cr.openjdk.java.net/~sherman/4235519/score1)
-Sherman
On 10/11/12 11:38 PM, Xueming Shen wrote:
>
>> On 10/11/2012 02:43 AM, Stephen Colebourne wrote:
>>
>>> There are lots of other public base 64 implementations to test/check
>>> against.
>>> http://commons.apache.org/net/api-3.1/org/apache/commons/net/util/Base64.html
>>>
>>> http://www.cs.berkeley.edu/~jonah/bc/org/bouncycastle/util/encoders/Base64.html
>>>
>>> http://migbase64.sourceforge.net/ (claims to be fast)
>>
>
> I did a quick performance check against migbase64 with the basic
> base64 de/encoding
> using this non-scientific benchmark.
> http://cr.openjdk.java.net/~sherman/4235519/PermBase64.java
>
> Here is the scores
> http://cr.openjdk.java.net/~sherman/4235519/scores
>
> It's a tie, j.u.Base64 wins the decoding, but needs some work on
> encoding side.
>
> java -server PermBase64 200000 50
> j.u.Base64.encode() : 1390212
> migBase64.encode() : 720517
> j.u.Base64.decode() : 1200642
> migBase64.decode() : 2070015
>
> java -server PermBase64 200000 100
> j.u.Base64.encode() : 1239407
> migBase64.encode() : 740404
> j.u.Base64.decode() : 1257092
> migBase64.decode() : 2012910
>
> java -server PermBase64 200000 1000
> j.u.Base64.encode() : 1062212
> migBase64.encode() : 657342
> j.u.Base64.decode() : 1133740
> migBase64.decode() : 1930612
>
> java -client PermBase64 200000 50
> j.u.Base64.encode() : 961331
> migBase64.encode() : 875635
> j.u.Base64.decode() : 1528790
> migBase64.decode() : 2188473
>
> java -client PermBase64 200000 100
> j.u.Base64.encode() : 966453
> migBase64.encode() : 858082
> j.u.Base64.decode() : 1459159
> migBase64.decode() : 2115045
>
> java -client PermBase64 200000 1000
> j.u.Base64.encode() : 954401
> migBase64.encode() : 854903
> j.u.Base64.decode() : 1444603
> migBase64.decode() : 2038865
>
>
More information about the core-libs-dev
mailing list