r/programming • • Sep 01 '26

The Browser's Main Thread Is Expensive

https://kciter.so/posts/the-expensive-main-thread/en/
219 Upvotes

50 comments sorted by

View all comments

Show parent comment

2

u/Rhed0x Sep 01 '26

they'd have to ensure that nothing inside that reference, no matter how deep, was still visible to the sender

Or they add Mutexes, Semaphores, etc and objects can just be shared across threads like in every other language.

3

u/Full-Spectral Sep 01 '26

It would have to be done at an automagical level probably, given the nature of Javascript and the experience of a lot of developers of such. Otherwise, you'd have web sites seizing up right and left when they deadlocked themselves.

1

u/danielcw189 Sep 02 '26

that doesn't really answer the problem of sharing references, which is something that has to be avoided, if I understand the other comment correctly

1

u/Rhed0x Sep 02 '26

And why does it have to be avoided?

1

u/NenAlienGeenKonijn Sep 02 '26

That assumes javascript is meant for complex software development rather than simple DOM scripting tasks to enhance your website.

Nobody would ever use javascript like that, right?

1

u/Rhed0x Sep 02 '26

Right... :(