3 ms·
Also, O(n) doesn’t mean much when the CPU can execute hundreds of checks in a few tens of cycles.
by nynx 4y ago
Also, O(n) doesn’t mean much when the CPU can execute hundreds of checks in a few tens of cycles.
- dzaima 4y agoNot for jumps - modern CPUs still (usually) have limit of one taken branch per cycle, or 1 to 2 untaken branches. And usually branch prediction will be the limiting factor anyway, for which a single branch is gonna be faster than many.