Skip to content

Comment on Which is faster? while(1) {} or while(2) {}parent

Comments

The question can be interpreted in different ways. For example: (1) "Which of these infinite takes the longest to run to completion?". Another interpretation could be: (2) "We want to write an infinite loop, which of these two ends up with the most efficient code?".

I don't think anyone is missing the point that an infinite loop takes infinite time to terminate, it's just not a very interesting point to make. Getting "hung up" on (1) means missing out on potentially interesting insights found when answering (2).

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.