Skip to content

Emscripten parameters

Sylvain Chevalier edited this page Jun 1, 2014 · 4 revisions

There are numerous options that can be given to Emscripten, Here we try to summarize how they can affect pocketsphinx.js.

  • ASM_JS: On Firefox, pocketsphinx.js runs much faster with ASM_JS=1. On Chrome, it is also a little bit faster. Note that ALLOW_MEMORY_GROWTH should not be enabled. We use the default value, which is to have AMS_JS enabled.
  • ALLOW_MEMORY_GROWTH: if enabled, ASM_JS gets disabled which has a large impact on speed. See below on how to deal with memory. We use the default value, which is to have ALLOW_MEMORY_GROW disabled.
  • OUTLINING_LIMIT: seems to have little influence on speed. We use the default value, which means that there is no limit.
  • TOTAL_STACK: seems to be slightly slower when set to higher values than the default one. We use the default value.
  • TOTAL_MEMORY: while the default value might seem large enough for the default acoustic model at first (at least without added words and grammars), it quickly becomes too small. We have changed it from the default 16MB to 32MB.
  • Optimization level (default to -O2): The generated JavaScript file is much larger with -O1 than -O2. -O3 does not seem to bring benefit. Optimization level does not affect speed very much.
  • --embed-file vs. --preload-file: With --preload-file, Emscripten creates a compressed file containing the data files. It makes download faster but also makes loading time way larger (for instance test 8 takes 0.3 sec with --emded-file and 6 seconds with --preload-file). Since the browser will cache the JavaScript files, download will only happen once, so the benefits of compressing them are minimal. We use --embed-file, and describe in README.md how to package models in separate JavaScript files.
Clone this wiki locally