How I wrote the Fastest JavaScript UI Framework
Bold claim, I know. And tomorrow it might not even be true. But right now with the release Chrome 72, Solid has taken the coveted top spot in the JS Frameworks Benchmark. (Technically #5, but the top 4 implementations are handwritten “vanilla” reference implementations that has the implementor directly managing DOM API mutations.)
A lot more goes into writing a JS UI library than chasing benchmarks. I have the distinct advantage of a substantially smaller user base than most competitors. But I woke up this morning, on my Birthday no less, to see that while I’ve been spending my recent time improving compatibility and adding features, Solid silently crept up thanks to the latest Chrome. It was the realization that as browsers get more optimized the approach taken here will only get better that has prompted me to write this article. I didn’t really invent anything new but it’s the way Solid puts it together that makes the difference.
1. Pre-Compile your Views
This is a big one. While not necessarily producing the least overall code to transfer over the wire the work you do ahead of time pays dividends later. This compilation doesn’t need to happen during the build step and can happen in the client as long as you aren’t taking the cost on each update. The performance hit especially for smaller apps…