I was looking at Nim benchmarks here: 
[https://github.com/kostya/benchmarks#base64](https://github.com/kostya/benchmarks#base64)
 , and noticed that Nim's base64 is so far behind the simple C implementation. 
I took the plain C algorithm and ported it to Nim without using any crazy C's 
pointers etc... and its just as fast as C on my computer. I learned 3 things:

  * benchmarks are a game.
  * you can always beat or come close to C with Nim.
  * Nim's base64 standard library implementation is slow. (it has more features 
but does not handle errors?)



Here is my as fast as C implementation: 
[https://gist.github.com/treeform/900f55d4bc08e57fe2257360b5f9fa68](https://gist.github.com/treeform/900f55d4bc08e57fe2257360b5f9fa68)

It looks like you can go faster if you use SIMD stuff, like this C library: 
[https://github.com/aklomp/base64](https://github.com/aklomp/base64)

Reply via email to