Skip to main content

Solid 2.0 on a Bigger App: Does the Bundle Gap Shrink?

Updated 6 min readMarkdown
Solid 2.0 on a Bigger App: Does the Bundle Gap Shrink?

Alex Yu asked the question in the comments under my last Solid piece, and it was the right one to ask. The small app I built for Solid 2.0 shipped 59.84 kB of JavaScript against 15.06 kB on Solid 1.9.19, production build, tree-shaken. Four times the code for the same counter and list. But was most of that the new reactive core, and does the gap shrink when the app gets bigger and the framework cost becomes a smaller share of the total? I built the bigger app to find out.

The app is a five-page catalogue demo with routing: a home page with a counter and a short delayed list load, a 48-item catalogue with search, a category filter and sorting by name, price or rating, a product page for each item, an about page and a settings form, plus a 404 page. The same app on both versions, the same 48 seeded items, the same pages. Only the framework version changes.

The numbers first. Solid 1.9.19 with its router ships 40.49 kB, gzip 15.38 kB. Solid 2.0.0 with its router ships 70.29 kB, gzip 27.70 kB. Against the small app, the gap was 44.78 kB, a ratio of 3.97 to 1. On the bigger app the gap is 29.81 kB, a ratio of 1.74 to 1. So yes, the gap shrinks, both in absolute terms and as a ratio. Alex Yu's hunch was right.

The more interesting number is how each version grew. The 1.9.19 app grew from 15.06 kB to 40.49 kB when the app got bigger, an extra 25.43 kB of pages and routing. The 2.0.0 app grew from 59.84 kB to 70.29 kB, an extra 10.45 kB. The bigger app cost the 2.0 build less than half what it cost the 1.9 build, because the 2.0 bundle was already paying for machinery the bigger app uses. That is the whole story in one comparison: 2.0 charges you up front, then the marginal page is cheap.

I pulled both bundles apart with a bundle analyzer to see which piece costs what. The sizes below are pre-minify module sizes, so read them as shares, not as bytes that add up to the totals above.

On 1.9.19, the router costs more than the framework. The router is 44.0% of the bundle and Solid itself is 41.6%. The app code is 12.9%. The single biggest file is the Solid core at 21,332 bytes, then the web renderer at 17,416, then the router's routing file at 13,981.

On 2.0.0, one package is most of the bundle. @solidjs/signals, the new reactive core, is 59.4% of the whole thing. Its two biggest files alone, the scheduler at 42,799 bytes and the core at 38,623, are larger than the entire 1.9.19 app code twice over. The router is 29.0%, the web renderer 6.5%, the app code 4.1%. And solid-js itself is 0.7%: in 2.0 it is a thin layer over the signals package and the web package. So to Alex Yu's first question, is most of it the new reactive core: yes, clearly. Three fifths of the bundle is the signals package, and the router is the second cost, not the first.

The router deserves a closer look because it changed shape between versions. On 1.9.19 the router's biggest file is its routing code. On 2.0.0 the router's biggest file is still routing, at 26,303 bytes, but the second biggest is its data file at 19,762 bytes, the code behind the query and form-action features. My app never calls those features. They ride along anyway. That is 19,762 bytes of pre-minify code for a feature the app does not use, inside a router that is itself a third of the bundle.

Building the bigger app also forced two migrations the small app never touched. The router in 2.0 is a rewrite, not a bump. There is no Router component, no Route component and no link component. Routes are plain config objects handed to a function, links are ordinary anchors, and route parameters come from a hook. I had to rewrite the app shell for 2.0, not just change a version number. And on 1.9.19, the shared nav taught me something too: every direct child of the old Router is treated as a route definition, so a nav placed there as a plain child breaks the link component, which throws because it has no router context. The nav has to live in a root layout. The small app had no nav, so this never surfaced.

Both apps render all five routes, which I checked by loading each built page and reading what it produced: home, the 48-item list with its $3,733.54 total, product 7 ("Silent lamp 7", $79.96), settings, and the 404 page. One test note: the 2.0 router reads a timing value on startup that the test page I used does not provide, so the check needed that value filled in first. Real pages provide it. The app itself was not changed for the check.

So where does that leave the 2.0 bundle question? The 4x figure from the small app was real but it was the worst case: a tiny app where the framework is nearly everything. On a five-page app with routing, the gap is 1.74x and 29.81 kB. That is still a real cost, and it is still mostly the new reactive core, but it stops looking like a cliff and starts looking like a fixed charge. If your app is one counter on a page, 2.0 is a heavy choice. If your app is five pages with routing, lists and forms, the extra cost buys you a router and a data layer you may or may not use, and the pages themselves stay cheap. The honest version of the 2.0 story is not "four times the JavaScript". It is "about 30 kB more on a real app, most of it a new reactive core, and the next page costs less".


P.S. Everything I write stays free — that part doesn't change. But if this one was worth something to you, you can buy me a coffee ☕ (one-time or monthly, both work). It covers the API credits and hosting behind these experiments — and honestly, it's also the nudge that gets the next one started on the evenings I'd otherwise skip it. — Salam

Buy me a coffee

No comments yet. Be the first to comment.

More from this blog