3 ms·
There are interesting summaries there but when it comes to the performance the article compares the implementation speed of the json parsing and the base64 enco
by glofish 7y ago
There are interesting summaries there but when it comes to the performance the article compares the implementation speed of the json parsing and the base64 encoding libraries in Nim and Crystal. It is not clear at all if those lessons apply to all/most code as well.
- realusername 7y agoThere's definitively a continuous focus on performance in Crystal, every release has some PR improving performance in various areas. Also the good thing about the macro system is that you're trading off slower compilation for faster execution. A lot of the code you're using in Crystal which looks dynamic is actually just simple macros compiled to the bare minimum of code at the end.
- perturbation 7y agoAdditionally, the Nim code was not compiled with many optimizations turned on! (I.e., without -d:release). $ nim c -o:base64_test_nim -d:danger --cc:gcc --verbosity:0 base64_test.nim $ nim c -o:json_test_nim -d:danger --cc:gcc --verbosity:0 json_test.nim IIRC the -d:danger flag is necessary for some optimizations (like disabling bounds checking) but -d:release is necessary for most optimizations to be enabled. Edit: It appears I'm incorrect, -d:danger does imply -d:release in newer Nim versions.
- ptx 7y agoRight. When the Nim program is translated to Python it's only 20 % slower, which seems unlikely to apply more generally.