This switches the decoder from using an Emscripten compile to a hand port. The encoder is still compiled with Emscripten.
There are a number of advantages to this:
Much smaller code. The hand ported decoder is less than half the size of the Emscripten version when minified.
Less memory usage. See #3.
Hand port is significantly faster than Emscripten compile with almost no hand optimization:
Hand Port x 99.29 ops/sec ±0.59% (72 runs sampled)
Emscripten x 40.81 ops/sec ±0.68% (54 runs sampled)
Hand Port is the fastest
Emscripten is 59% slower
This port was originally done a while ago, and I'm just getting around to finishing it up. Therefore, it is based on an old version of the C decoder. Most of the changes since then have to do with streaming support, which isn't supported here (yet). I did, however, port back the functional decoding changes to support the latest spec. The JS version passes all tests from the latest Brotli decoder test suite.
This switches the decoder from using an Emscripten compile to a hand port. The encoder is still compiled with Emscripten.
There are a number of advantages to this:
Hand port is significantly faster than Emscripten compile with almost no hand optimization:
This port was originally done a while ago, and I'm just getting around to finishing it up. Therefore, it is based on an old version of the C decoder. Most of the changes since then have to do with streaming support, which isn't supported here (yet). I did, however, port back the functional decoding changes to support the latest spec. The JS version passes all tests from the latest Brotli decoder test suite.