-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Benchmark] 4. C/C++ benchmark code is not fair #4
Comments
Thanks! There are two things...
So you're correct it's not fair at least by 50% because e.g. Python does not have compiler optimization mechanisms....
The absence of compiler in your programmig enviroment is your problem. ==== In that particular piece of code compiler did:
Conclusion: |
At least it worth to note, that C++ can remove |
I tried to compile that sample without optimization using MSVC++. Application fails to start as it cannot allocate 10MB on the stack |
In case if I allocate the |
The C++ code of the benchmark in the "[Why learn C++ if I know Python (Toy Example)" is not fair. Because code operate on local variables which do not have any aliases and
a
is a regular C-array, C++ compiler can removefor()
loop completely and just sets
into some compile time value.The text was updated successfully, but these errors were encountered: