8KB gzipped size increase in 0.181.0! (recommendation on tooling to analyze package size)

I have a very basic Scene and importing just.

import { Scene, PerspectiveCamera, WebGLRenderer, BoxGeometry, MeshBasicMaterial, Mesh } from ‘three’;

gziped of that component was 117.77 kB.

upgrading from 0.180.0 to 0.181.0 that went up by 8kb, to 125.03 kB compressed!

That’s a substantial change. I obviously can’t decrease the size if I want to go with v 0.181.0.

I would assume it’s WebGLRenderer, or Scene that got the code bump.

Apart from doing a diff comparison on three src, any one use tooling that can be used to assess where the size is coming from?

@Mugen87

Not quite the answer that you look for, but you can see individual PRs that made r181 and their size contribution. For example this pull request:

says:

Thanks for sharing that Pavel, I did come across that but it didn’t reflect a 8KB size increase.

which is quite considerable. Keep in mind from v0.180.0 to 0.181.0 I am importing the same packages.

I’m sticking with v0.180 until I can asses where the 8KB is coming from.

on a side note this might be a perfect use case to use AI tooling ;).

There are many PRs for a single release, some increase size, others - decrease. If you check the other PRs you might find where these 8KB come from. Most likely they are accumulated from many changes, not just one. I found a PR that adds 1.5KB to a compressed minimal scene. A few others like it and you will start asking why the increase is only 8KB.

Anyway, if you find how to identify the origin of the increase, post it here. Maybe somebody else would find it useful.

1 Like

It is not unusual that the size of the library varies. If we enhance the engine, it means we add new lines of code or entire new modules which eventually increases the overall size of the build files. Depending on what parts of the engine you are using, some of these additions can be removed via tree-shaking. Others not which is true for all changes regarding the renderer.

The most noticeable for this topic in WebGLRenderer is below which improved the quality of image-based lighting.

It requires a precomputed lookup table in form of a texture which adds alone 17KB (unzipped) to the renderer.

To me, 8KB isn’t much since it’s barely noticeable during a download. Besides, in WebGPURenderer the materials are less coupled with the renderer. So unlike in WebGLRenderer, the LUT should not be included in the build if you are not using PBR materials.

2 Likes