1
General discussions / Re: Incredible performace of Lua (luajit) over C++
« on: June 16, 2015, 03:11:37 am »Modern C++ compilers will also take advantage of SIMD instructions as well (if you let them optimize for modern CPUs) and are actually quite aggressive about vectorizing loops and other code constructs.
I know that. However, once you've compiled C++ to use SIMD you can't run your program on a CPU that doesn't feature those instructions. With Lua on the other hand, this is decided at runtime and uses it only if the CPU supports that feature. Therefore your LuaJit program can run both on an old CPU and use only the available instructions and on a newer CPU and use newer instructions without having two binaries.
But that wasn't the point of my post. I simply suggested that LuaJit might have optimized the resulted instructions while C++ didn't (probably wasn't allowed). Which means that the result of the benchmark is almost irrelevant.