@jslakro commented on a post by @johntitor Nov 26

In conclusion, never use a querySelector if you have opportunity to use getElementById instead. A similar comparison to have an index scan vs table scan in SQL

A while ago, I was curious how the speed of document.getElementById compared to document.querySelector in Javascript for selecting a single element by ID. querySelector has to do a lot more work, so one would expect that it would be slower, but I didn’t know if the difference was enough to care about.

I wrote a little benchmark to test this. You can run it by clicking

. This creates 100,000 elements, and then selects them all in a loop. It does this 105 times, and ignores the first 5 results (to avoid caching effects). It then plots a historgram of the average time per function call (in milliseconds) for each run. There is a template string used in the loop that I’m testing, so the exact numbers are slightly inflated, but in a way that is consistent across both functions.

Read More
@jslakro commented on a post by @mae4_king Nov 26

Starcraft

What is your ravorite game from Blizzard? My winner is World of Warcraft

@jslakro commented on a post by @root Dec 2, 2020

What other bands in that time or right know could be compared in terms of sound?

Nov 18, 2020

From waaaaay back in the day…