https://github.com/Kiakra/test-benchmark/tree/master/test%202
I think i saw other benchmarks and nim was fast as c in them.
Why it is much slower compared to LuaJIT and C?
Is it possible to make it faster?
https://github.com/Kiakra/test-benchmark/blob/master/test 2/main.c https://github.com/Kiakra/test-benchmark/blob/master/test 2/main.nim
Output from your program is same to the program that quit with do nothing. Modern C/C++ compiler remove any code that doesn't affect outputs. If you want to benchmark how compiler's optimizer optimize your code, output result of calculation to stdout or somewhere.
nim result: (compile: nim c --cc:clang --opt:speed -d:release)
clang can run calculation in following code at compile time and generate a code that only print a number. https://godbolt.org/z/CoNKav
You need to take some number at runtime and use it in your calculation if you want to run your calculation at runtime. https