[–] ZYX321 0 points 7 points (+7|-0) ago 

Spoiler, it's not. Second answer probably covers it.

Also, I'm quite rusty here, but initializing the C++ program from 0 may be more intensive than initializing the JavaScript in an already-loaded interpreter. I expect there are certainly cases where Javascript is faster for simpler things... or for badly written code... but it's certainly no where close to a rule.

[–] DrFingers 0 points 2 points (+2|-0) ago 

The clock isn't starting when the program is loaded, it's starting before the for loop. Although clock implementation is different here. In JS, he's just asking for a time stamp, where in C++ he's calling clock. I think they do similar things, but using time stamps for benchmarking isn't very accurate.

[–] whisky_cat 0 points 4 points (+4|-0) ago 

My favorite part is how the JS interpreters are written in C++

[–] Durm 0 points 0 points (+0|-0) ago  (edited ago)

Came here to say this

To be fair there are instances like some kinds of code in Fortran which could make a better for loop because the compiler is more free to make the loop however it wants. But anyone whos seen the super fat ass V8 code, the overall top player still, could never in all seriousness agree with the OP title as stated.

[–] catkisscat 0 points 0 points (+0|-0) ago 


[–] lesshateplz 0 points 0 points (+0|-0) ago