2 ms·
In C, this loop would get unrolled to a no-op in a release environment. Source: https://godbolt.org/z/1sb5Tb3xv https://godbolt.org/z/1sb5Tb3xv
by beebmam 4y ago
In C, this loop would get unrolled to a no-op in a release environment. Source: https://godbolt.org/z/1sb5Tb3xv https://godbolt.org/z/1sb5Tb3xv
- codedokode 4y agoI used an empty loop just to simplify an example. Obviousy in real code the loop would do domething useful and wouldn't be optimized out.
- colejohnson66 4y agoBut if your loop is busy doing stuff that’s hundreds of bytecode ops long, is worrying about the few extra bytecode ops that a for loop takes worth it?
- the-smug-one 4y agoIt's not like those hundreds of bytecode ops aren't slow as molasses too, for similar reasons.
- joaommartins 4y agoHow else would they feel superior to someone else, if not by comparing Python/JS to C's speed all the while talking about applications where C is never going to be used?