Comment

Comment by lhorie

OP is explaining their methodology poorly. The 62ms number is the time it takes to run the call 100,000 times, in a loop, with a string interpolation. And measurement is done by taking the delta of two performance.now() calls, which are known to be precise to only about 1ms for spectre mitigation[0].

FWIW, JS old timers have known querySelector is slower than getElementById since querySelector became a thing.

[0] https://developer.mozilla.org/en-US/docs/Web/API/Performance...

parent lhorie 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton