I noticed the total zipped size of an asset (say vendor.js) as shown in the analyser output is much bigger that the real one.
Which is understandable given how we compute that number: we just compute the sum of all (individually zipped) sizes of the modules it contains. However zip/deflate (especially its duplicate string elimination) will work much better on a large concatenated file containing all modules, than when applied to all single modules individually. Which explains the difference AFAICT.
Maybe we should compute the zipped size of the whole asset file, and "spread" that to its individual modules proportionally (like zipped module_size = total_zipped_size / total_minified_size * minified_module_size)?
I think its inherent to the compression algorithm that we cannot accurately determine how much a given module will attribute to the total (concatenated) zipped size, but this could be a good enough approximation, that makes sure that the sum of all zipped module sizes equals the real zipped size of the concatenated file.
@stefanpenner the changes required for this are probably not very difficult, I can try to bring up a PR when we agree on this!
I noticed the total zipped size of an asset (say
vendor.js
) as shown in the analyser output is much bigger that the real one.Which is understandable given how we compute that number: we just compute the sum of all (individually zipped) sizes of the modules it contains. However zip/deflate (especially its duplicate string elimination) will work much better on a large concatenated file containing all modules, than when applied to all single modules individually. Which explains the difference AFAICT.
Maybe we should compute the zipped size of the whole asset file, and "spread" that to its individual modules proportionally (like
zipped module_size = total_zipped_size / total_minified_size * minified_module_size
)?I think its inherent to the compression algorithm that we cannot accurately determine how much a given module will attribute to the total (concatenated) zipped size, but this could be a good enough approximation, that makes sure that the sum of all zipped module sizes equals the real zipped size of the concatenated file.
@stefanpenner the changes required for this are probably not very difficult, I can try to bring up a PR when we agree on this!