DEV Community

loading...

Should you ignore scripting time of virtual-dom?

svaani profile image Vani Shivanand ・1 min read

In one of my post's comment section I made a statement saying,

Scripting time will be more because it was considered by any virtual-dom framework that to re-draw the tree should be optimized more than the amount of javascript that is being run.

A straight forward opinion might be to optimize scripting time is as important as it is to optimize Layout or DOM rendering. But we might want to remember web-workers here.

Workers provide multi-threading or a parallel process along with the main thread but they don't have access to DOM and other entities. As we speak about virtual-dom getting overloaded with higher scripting time, the entire operations can be moved there.

That's the reason, why the upcoming new opinion virtual-dom is not needed might not survive longer. Frameworks/libraries with virtual dom should adapt to workers.

Another issue with workers might be Structured Cloning or deep-copying which needs to be worked upon. Because to communicate between them, a huge object needs to be passed. This can be fixed by taking an input from the developer on which part of the tree might be under the scope of change. Thus reducing the tree size that is being communicated between Worker and main thread.

Thanks for reading!

Discussion

pic
Editor guide