I've just uploaded a project to Source Forge. It's a Base64 Codec.
"MiGBase64 is a very fast and small Base64 Codec written in Java. It is currently faster than any other Java codecs I know of and it doesn't create any temporary arrays which many others do. 3-30x faster than Sun's and 2x faster than Commons Codec"
Interesting. How did you actually get that kind of a performance boost compared to other implementations? And how are you avoiding the temporary arrays? By creating a big enough array in the beginning that you know won't need a resize?
I couple of smart tricks ;-). Basically moving ALL but the absolute necessary out of the main loop.
Temp array: When encoding the array is possibly to precalculate, for decoding I have a normal and a "fast" varsion. Both are "fast" though. the normal do a pre-scan to know the exact returned length and the "fast" version has to be fed with data that are somewhat well behaved:
+ The array must have a line length of 76 chars OR no line separators at all (one line). + Line separator must be "\r\n", as specified in RFC 2045 + The array must not contain illegal characters within the encoded string + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
ps. You can check out the source, it's only some 50 lines per encode/decode pair.
Joined: Jan 23, 2002
Joined: Jul 15, 2004
Also a lot of performance charts is posted on the home page at: