Tree Shaking Three.js

by comparing the bundle size with a 300 KB JPEG I actually just had a mere comparison between loading a bundle.js and loading some heavy image in mind, didn’t think of evaluation and decoding, you’re right.

Anyway, I checked our website regarding this and we get almost the same (a bit lower) bundle loading / evaluation time compared to loading the first image (PNG) which is about 30% (97KB) of the gzipped bundle size (281KB), that’s why taking a few more KB for the bundle into account doesn’t appear as a huge problem to us, see:

cream_gmbh_loading_bundle
cream_gmbh_evaluating_bundle
cream_gmbh_loading_first_image

With lower bandwidth settings (fast 3G) this looks a bit different:
2.17s for loading bundle (evaluation time unchanged) vs. 1.28s loading the image.

This doesn’t mean we wouldn’t like having more creativity with materials / shaders and even lower bundle sizes with node-based materials, just trying to clearly understand the main benefits of it.