AWS Developer Tools Blog
Follow up on Base64 Codec Performance
After we posted the previous blog, A Fast and Correct Base64 Codec, some readers expressed interest in getting more details about the comparison of various codecs’ performance. So this blog post is a quick follow-up with a side-by-side decode/encode performance comparison of various Base64 codec’s, including AWS SDK for Java, DataTypeConverter, Jakarta Commons Codec and Java 8.
To generate the performance data, we used the same test suite as in the previous blog, except this time we ran the tests in a Java 8 VM (instead of Java 7 as in the original blog) so as to include the Java 8-specific Base 64 codec for comparison. (The particular JVM is Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode.)
As you can see from the graph and statistics below, in terms of raw performance, the DataTypeConverter is the fastest in terms of Base64 decoding, whereas Java 8 is the clear winner in terms of Base64 encoding. However, as explained in the previous blog, decoding speed is not the only factor in selecting the Base64 decoder for use in the AWS SDK for Java, but also security and correctness.
Hope you find this information useful.
Decoder Performance
(Decoder performance statistics associated with the graph generated via R above.) | |
vars n mean sd median trimmed mad min max range skew kurtosis se Commons 1 1000 24.28 4.36 24 23.88 4.45 18 50 32 1.06 2.12 0.14 DataTypeConverter 2 1000 8.51 2.55 8 8.14 1.48 6 51 45 5.83 79.84 0.08 Java8 3 1000 11.43 2.96 11 11.11 2.97 8 60 52 4.85 70.63 0.09 SDK 4 1000 13.77 2.80 13 13.47 2.97 10 39 29 2.27 13.50 0.09 Commons DataTypeConverter Java8 SDK |
Encoder Performance
(Encoder performance statistics associated with the graph generated via R above.) | |
vars n mean sd median trimmed mad min max range skew kurtosis se Commons 1 1000 21.94 3.68 21 21.46 2.97 17 69 52 2.99 27.04 0.12 DataTypeConverter 2 1000 11.88 9.70 10 0.91 1.48 7 148 141 11.06 127.96 0.31 Java8 3 1000 7.22 3.56 6 6.91 1.48 5 99 94 18.08 447.36 0.11 SDK 4 1000 11.84 9.66 10 10.84 1.48 5 139 134 10.52 114.39 0.31 Commons DataTypeConverter Java8 SDK |