$ for f in *.js; do echo $f - $(gzip $f -c | wc -c); done
example.js - 178
without-0.js - 173
without-1.js - 172
without-01.js - 170
We have four nearly identical code blocks at indexes 0, 1, 2, 3.
The experiment:
- All:
178
bytes - Without 0:
173
bytes. Theoretically, 0 is5
bytes - Without 1:
172
bytes. Theoretically, 0 is6
bytes - Without 0 and 1:
170
bytes. Together, the actual removal reduces the total bundle by8
bytes, which is less than5 + 6 = 11
individually.