Hi there,

My apologies in case this topic has already been discussed before. 

It is well known that one of the biggest bottlenecks in web application 
performance are DOM operations. While the recommendation to developers is to 
try to not update the DOM and trigger reflows if it is not completely 
necessary, doing this is extremely difficult and doesn't really scale with big 
applications, like many of Gaia's system apps.

There are some ideas on how to improve that, along with some projects that have 
come up with pretty elegant solutions. As an example, React.js has worked 
around that problem by recreating the DOM with lightweight JavaScript objects, 
along with a W3C-compliant event system. When developers change the DOM or 
trigger events, they don't have to worry about causing reflows or slowing down 
the application, since they are not modifying the real DOM, but the virtual 
DOM. React then applies these changes, and through some smart optimizations, 
diff algorithms and event delegation, figures out what has changed and batches 
all the DOM operations at the end of the event loop. A much better technical 
explanation of how this works can be found here[2].

There are other attempts at batching DOM operations like fastdom[3]. In any 
case, it makes sense that these efforts result in big performance improvements, 
according to benchmarks[4, 5]. This would be even more significant in mobile 
platforms like Firefox OS.

Far from proposing to use React.js in Gaia, I still think that automatically 
batching the changes that DOM operations cause at the end of the event loop is 
a good idea that will benefit apps performance in Gaia enormously. Have there 
been any thoughts on implementing anything similar for Firefox OS? Is it worth 
it to look into it or even propose an implementation of the idea?

Cheers,

Sergi


[1]: http://facebook.github.io/react/
[2]: http://calendar.perfplanet.com/2013/diff/
[3]: http://wilsonpage.co.uk/preventing-layout-thrashing/
[4]: http://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/
[4]: http://wilsonpage.co.uk/preventing-layout-thrashing/
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to