Earlier quoted context omitted.
Don't pick a fixed value for the batch size; render until your time is exhausted and then wait for the next batch. Yes, this'll be slower overall, but you ensure that the app stays responsive regardless of device or CPU availability.
Are you recommending an app imposed rendering timer (say 15ms) or is there an in built API for Opportunistic scheduling of Dom updates?
WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
51–60 of 62 posts
Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#52Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#53Earlier quoted context omitted.
doesn't the added vdom lead to redundancy?
No, in fact it's likely very beneficial. Virtual DOM is meant to avoid the overhead of interacting with the real DOM (reading and writing to the DOM is slow). Being inside a web worker means that you're still interacting through the DOM, just via a web worker now. So the cost of reading and writing to and from the DOM is still present, plus there's the added overhead of communicating with the UI thread. So vdom in th…
So now there are two VDOMs
Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#54I don't quite understand how busy your page must be if you feel that you're held back by the performance of one thread with the DOM. You know, DOM isn't really for video games or realtime data visualization.
I think this is more useful from the perspective of, if you have some busy task and you need to get the data back into the DOM, what can you do? You either need to build a messaging layer, which was the defacto way, or use this. I have a few projects that could benefit from this, being able to put a progress bar in the DOM and have the worker update it in a clean API is pretty neat.
I'm not saying having the lib is bad, but I don't see a justified use-case for it.
Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#55Earlier quoted context omitted.
No, in fact it's likely very beneficial. Virtual DOM is meant to avoid the overhead of interacting with the real DOM (reading and writing to the DOM is slow). Being inside a web worker means that you're still interacting through the DOM, just via a web worker now. So the cost of reading and writing to and from the DOM is still present, plus there's the added overhead of communicating with the UI thread. So vdom in th…
I know how VDOMs work. But the WorkerDOM has an extra one to the one current frameworks bring. So now there are two VDOMs
Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#56Earlier quoted context omitted.
React, Vue and other modern frontend frameworks already rely on a vdom implementation.
That's what I meant with redundancy.
Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#57I worked on a similar project a few years ago: https://github.com/canjs/worker-render . It could render jQuery apps in a web worker, it was pretty neat. The problems I ran into, and I suspect this project will run into many of the same things were: 1. Events are synchronous so to make them async you have to preventDefault them, send to the worker, and then send back and re-dispatch them (if the worker didn't preventD…
I think it works better because the original framework wrestles with the same limitations you mention (though an upcoming rearchitecture doesn't), and while it is by no means perfect, some early results are promising: https://rndom-movie-demo.now.sh
Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#58At least, that is how it worked a few years ago.
Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#59Re: WorkerDom – The Same DOM API and Frameworks You Know, but in a Web Worker
#60WebWorkers: Same great JavaScript, now with concurrency bugs!