Counting steps
Read · 1 of 3
Speed is about growth
JavaScript manages roughly 100 million simple steps per second. What matters is how the steps grow with the input size n.
One loop over n items: about n steps, O(n). A loop inside a loop: n × n, O(n²). Halving each time: O(log n). Looking something up in a Map or Set: about one step.