loading...

re: What The For Loop? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: I assumed that a modern compiler would take care of this anyway. So I wrote a meaningless test program in C: #include <stdio.h> void main...

oh that's cool to see, thanks for sharing that.
I found this reply post in a stackoverflow thread on the matter

Performance. jsperf.com/modulo-vs-bitwise/8 Bitwise is faster across most browsers (or, it was at the time the answer was posted, in recent Chrome's there is not much difference tbf – danwellman Jan 15 at 9:05

Sure, the example I showed uses native code, not JS. Though as the post you quoted indicates it seems JS engines are always getting smarter too, and the most recent version of the same test shows the following for newer Chrome versions:

imgur.com/a/QcxZigt

Blue is bitwise and red is modulo, which means in 2 versions there's no speed difference at all and in the 3rd modulo was actually faster.

yeah, well, I posted it to support what you were showing, not as an argument. It was more just meant to be extra information than anything else.

Oh, sorry if there was any misunderstanding, I never construed this as an argument, I just added this since the quote in your comment said "in recent Chrome's there is not much difference tbf" and I had nothing better to do so I looked at the newest version of the benchmark.

code of conduct - report abuse