It occurs to me that, during querySelector execution, components of a selector which match only by ID (or maybe by ID at all) could be maybe linearly or sublinearly resolved by calling the native-code implementation of getElementById. Per at least the MDN docs [1] [2], both return an Element, so nothing downstream will see any difference.<p>If the entire selector is a single ID matcher, execution time for querySelector probably would not be that much longer than for direct calls to getElementById; depending on implementation there might not even be any more stack frames. (Which would be a pain and might not matter, but there are a few ways you could do it if it did.)<p>In iOS 14.8 on this iPhone 12 mini with about half a battery, the getElementById test took 20ms, and the querySelector test 47. Of course I don't know what the implementation is actually doing, but those times seem awfully close together compared to those the author quotes.<p>[1] <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/API/Document/ge...</a><p>[2] <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/API/Document/qu...</a>