I was writing code for Base64 encoder today. I was able to.
And then it occurred to me – “How about writing a function which can theoritically encode file of any arbitrary size.”
So I proceeded, to read bytes, encode them, write them to a file.
And then came in the second challenge – breaking the BIG base64 string into fixed-width lines (doesn’t sound challenging ? Try it!)
I was successful after burning out some brain cells.
But the joy of flexibility did not last long … read on to know why …
- Target : encode 80 MB binary file.
- My code takes 4.3 seconds (average)
- GNU base64 took only 2.5 seconds
-
A lag of 1.8 seconds, not as efficient as ‘The Gurus’ …
Note: The programming language I used was Java. Say … how about trying out the same in Python ??