Significant bundle size increase since v9.3.0 #4314
-
In the release notes of v9.3.0, it was noted that one of the significant changes was "25% Smaller" bundle size. However, immediately after that in v9.4.0 the bundle size increased by 3x, from 878KB to 2.65MB. Even though in v10.x the UMD bundle was removed (seems likely to be re-added soon via #4281), a minified build I was able to create locally was 2.69MB. Does anyone know what contributed to the tripling in bundle size? It feels quite significant and possibly due to some error in dependency handling. (Back of my mind thinking: what new feature addition could have weighed twice the size of v9.3.0!) |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 7 replies
-
While I understand that 2.7MB is very little in today's data sizes, I would still like to be extra conscious of my bundle sizes. My concern mostly comes from the fact that loading 2.7MB will take a loooong time on mobile networks, especially given how aggressive Google Lighthouse throttles download speeds when scoring web pages. ESM helps with lazy loading, but at the cost of latency due to the extra round trip downloads. |
Beta Was this translation helpful? Give feedback.
-
Bulk of the size is coming from 2 newly added diagrams. Flowchart-elk & mindmap. |
Beta Was this translation helpful? Give feedback.
-
It is worth mentioning that we are not loading all diagrams at once. The package is split so that only the diagrams encountered when rendering is loaded. This is what has opened up the gates to adding more diagram types and layout algorithms |
Beta Was this translation helpful? Give feedback.
-
A lite or tutorial version for generating mermaid.js for selected modules would be great. Currently TiddlyWiki 5.3.0 size is 2.3MB and mermaid.min.js 10.3.0 size is 2.8MB which makes it huge overhead especially in case we have the mermaid embedded in a single offline capable HTML file. |
Beta Was this translation helpful? Give feedback.
-
Please see #4734 11.0.0-alpha.4 has the mermaid.tiny.min.js in the CDN. |
Beta Was this translation helpful? Give feedback.
-
I think most of the concern with bundle size is based on the fact that most users don't use all the cool features all the time (a classic case of "any given user only uses 20% of the product, but it's a different 20% than everyone else"). So making everyone pay the bandwidth, cpu, memory, and loading latency to download and process the code for of all the features seems wasteful when only a fraction of the features are used in a particular context. I don't see anyone concerned with spending computing resources on features that are in use, just that the vast majority of the time end users and web admins are paying computing resources for features that are not being used. Is there a way to split up the bundle by feature so that the big resource-intensive (but also very cool!) features are downloaded on demand? |
Beta Was this translation helpful? Give feedback.
-
How can we reduce the bundle size? This is a seriously important thing to get sorted for production use cases. My app is bloated to the max for including mermaid.js |
Beta Was this translation helpful? Give feedback.
Bulk of the size is coming from 2 newly added diagrams. Flowchart-elk & mindmap.
They use 2 separate layout engines, Elk & cytoscape, which adds to the size.