Packaging size of html5 in ue4.16 over 200MB

I wonder if UE 4.16 added a checkbox in project packaging settings menu to enable compression. If compression is enabled, the files should come out with suffix “gz”. If there is no explicit setting to enable compression, try doing a Shipping build, that should be minified and enable compression for deployment purposes.

If for some reason UE4 does not automatically compress the .data and .asm.js files, you can manually gzip compress them with 7-zip. However when doing so, take a peek at the file sizes. I know UE4 is able to compress .data files by itself, so if the size of the .data file does not shrink when you manually compress, then there is no use in gzip compressing it for the web server, since it contained compressed data already and UE4 internally manages that.

The size of the .asm.js file however should dramatically get smaller when you gzip compress it. This file is only needed if you wish to host the old asm.js fallback for the page as well for compatibility reasons. WebAssembly is the new standard, which currently works on Firefox and Chrome, and Edge and Safari support is coming up soon.

The trick to make the page ask for these gz versions is to edit the main generated .html files and search for “.data” and “.asm.js” to find where the data file is loaded. To load the gz version, you can just add the suffix .gz to the filenames. the html file does so by default by using the “Module.locateFile()” function, search for its uses in the html file to see how its operationg.

Hi there,

I have just tried packaging in 4.16 an empty HTML5 project and I found that UE4Game.asm.js size is 200MB; MyProject.data is 100MB.

On the other hand packaging has not created gz files…

Am I missing something?

Thanks

Hello rsoriano,

Maybe this link helps. https://docs.unrealengine.com/latest/INT/Platforms/Android/ReducingAPKSize/index.html#packageblacklist

Thanks for answering,

Sertac, we tried it and indeed reduced the package size on 60MB.

Juj, there is a “compress files during shipping packaging” which created a couple of gz files, but none for the biggest files (.data and .asm.js)

I tried to make it manually with 7zip and it works with all files but it still asks for the .data file so it can’t be compressed (at least didn’t work for me.

I’ll let you know if we find out something else

Thanks a lot,
we already tried compressing all files with gzip but as I said it doesn’t load the.data file.
I’ve searched in the html code as you say an indeed there is something interesting:

// Asset packages do not benefit from gzip compression because they are already compressed at UE4 packaging time,
// and uncompressing very large gzip files would just slow down startup times.
if (!dataFileIsGzipCompressed && name.split('.').slice(-1)[0] == 'data') serveGzipped = false;

I changed the the condition to true and it worked. Now it’s just a matter of deciding if we preffer to decrease downloading or decompressing times.

Thanks juj :wink: