4 ms·
Seems like prime will be getting set to false redundantly instead of short-circuiting. Optimizing compilers will catch this. Also not a good test considering th
by goldenkey 11y ago
Seems like prime will be getting set to false redundantly instead of short-circuiting. Optimizing compilers will catch this. Also not a good test considering that different CPUs might see this with branch prediction, and the results will vary.
- kyberias 11y agoI'm not quite sure whether compiler optimizations could catch that. How could they? Returning false on the first zero remainder is a different algorithm.
- goldenkey 11y agoIts the same result. Compilers only need to produce the correct behavior. Algos arent part of that when optimizations take hold.