News for hackers. Stuff that matters.
Re:In spite of an increase in Internet speed, webpage speeds... by austincheney on Tuesday August 04, 2020 @11:26PM (#24056996)
500k ops is ridiculously slow for accessing the DOM on any modern hardware. It sounds fast when aren’t comparing it to anything. Compare that to a similar approach that makes use of the standard DOM methods and no selectors. The only thing querySelectors do faster is allow accessing elements by attribute.

The reason I refuse to post numbers myself is because:

1. I provided a tool where people can run any manner of discovery for their own numbers and see performance differences in various approaches.

2. People, when presented with a valid comparison will irrationally ignore results that challenge their opinion.

EDIT:

I looked closer at the measureit experiments and it seems there is some sort of bias. If you run the same experiment using an element already present in the page the results are the same for querySelector but 50% greater for the getElementById approach. Other perf tools I have tried did not display this kind of bias and they also reported substantially higher numbers for all user agents, most especially for desktop Firefox.

Re:In spite of an increase in Internet speed, webpage speeds... by daerogami on Tuesday August 04, 2020 @11:42PM (#24057068)
In response to 1, you're asking people to do their own research when you have stated the claim. The burden is on you.

As for 2, if it's such a problem, just don't make the argument. It genuinely comes off as wanting people to agree with you rather than any real interest towards engaging in actual discussion.

Re:In spite of an increase in Internet speed, webpage speeds... by austincheney on Wednesday August 05, 2020 @12:41AM (#24057296)
> The burden is on you.

Then just disagree with me.

Re:In spite of an increase in Internet speed, webpage speeds... by esperent on Wednesday August 05, 2020 @03:04AM (#24058036)
> 500k ops is ridiculously slow for accessing the DOM on any modern hardware. It sounds fast when aren’t comparing it to anything.

I didn't say it was fast OR slow. I just said it's not slow enough to be the problem that you're claiming it is.

If you disagree with this, could you provide evidence of a situation where accessing elements with strings is a bottleneck? As I said, I've never seen this in practice and if it can be the case I would like to know more.

> Compare that to a similar approach that makes use of the standard DOM methods

querySelector is a standard DOM method.

> and no selectors

I don't know what you're referring to here. Could you provide an example?

Re:In spite of an increase in Internet speed, webpage speeds... by austincheney on Wednesday August 05, 2020 @06:36AM (#24059194)
Re:In spite of an increase in Internet speed, webpage speeds... by esperent on Wednesday August 05, 2020 @11:39PM (#24067931)
I've seen so many benchmarks for these selectors I basically know them by heart. I'm asking for a real world example where selectors cause slowdown.
Re:In spite of an increase in Internet speed, webpage speeds... by foota on Wednesday August 05, 2020 @01:06AM (#24057438)
It doesn't matter if they're slower than the alternative, it matters how they affect the overall performance of the app.