How to avoid Firefox freeze and script warning when running HTML5 package?

Hi there,

I created a HTML5 game with UE 4.6.1 using C++. The overall size of the shipping package is 86 MB.

When running it in Firefox, right after downloading the game content and before running it, my browser freezes. On my older MacBook Firefox throws the an unresponsive script warning and I have to click continue 1-2 times.

My question is, whether I can tweak something so that this does not happen or not. I assume this has nothing to do with the package size as I ran other, larger projects than mine (e.g. UE Strategy game) without them resulting in a freeze or warning. So I guess it has to do something with the way everything is instantiated in my game?

I unsuccessfully played a little with the emscripten OUTLINING_LIMIT (see emscipten docs) parameter as I thought breaking large functions may helps. As I understand it, emscripten itself already implements an asynchronous main loop to let the browser get control and not hang up (see browser main loop). Does this only apply while running the game and not when “instantiating/starting” it?

Any ideas? Thanks in advance

I get “FMallocCrash overhead is 3801088 bytes” in the emscripten console. Maybe this has something to do with it?

Using the Chrome JavaScript CPU Profiler, I tracked down the heaviest js functions and tried to optimize. In my example the unresponsive script warning was popping up while processing all *.ini files. I got rid of unnecessary entries and now I’m glad it works, although it is kind of a hacky solution.