Live data from Hacker News

The browser's main thread is expensive

kciter.so

1–10 of 158 posts

Re: The browser's main thread is expensive

#6

Yeah, but if your website with, you know, text and stuff, doesn't do any stupid and unnecessary crap, it doesn't matter where the nonexistent unnecessary yet expensive code doesn't run.

and if you have no website at all, it takes zero seconds to load.

But for people who are developing websites that are more than just text, this is an excellently written article and great advice.

It's funny, for mobile app dev it feels like the community are a lot of focused on staying off the main thread, this is the first time I've come across one for webdev.

Re: The browser's main thread is expensive

#7

Yeah, but if your website with, you know, text and stuff, doesn't do any stupid and unnecessary crap, it doesn't matter where the nonexistent unnecessary yet expensive code doesn't run.

Sure, but there are sites like HN and there are sites like https://earth.nullschool.net/

What's your point? Are you saying all animations and rendering are unnecessary?

Re: The browser's main thread is expensive

#8

Yeah, but if your website with, you know, text and stuff, doesn't do any stupid and unnecessary crap, it doesn't matter where the nonexistent unnecessary yet expensive code doesn't run.

Well yeah but if you do actually need things like images, animations, high frequency updates, etc, this is actually a pretty good overview of how to approach it. Also learned that react uses posting to a MessageChannel to yield!

Re: The browser's main thread is expensive

#9
post #4

In the first example: doesn't pushing the button while typing cause the textfield lose focus? What's the point of the typing in the example?

I think the point is, if you click the '2.0s' button, you cannot re-focus on the input field for those 2 seconds.

Re: The browser's main thread is expensive

#10
Great piece, OP. We work in WASM and are considering web workers to help with rendering documents off the main thread in that context. I was surprised to read that ArrayBuffer is moved by reference only! Might be an option. Thanks for putting this together.
Post reply on HN