browsermt / bergamot-translator

Cross platform C++ library focusing on optimized machine translation on the consumer-grade device.
http://browser.mt
Mozilla Public License 2.0
341 stars 38 forks source link

Report the wasm size on builds #460

Closed gregtatum closed 1 year ago

gregtatum commented 1 year ago

The size of the wasm bundle affects the speed at which it can be loaded in the browser. This PR adds a report to the build-wasm.sh that shows the size both uncompressed, and compressed. The compressed size is generally what is actually downloaded by the end user.

Here is a sample output:

[ 98%] Linking CXX executable ../bergamot-translator-worker.js
'+sse2' is not a recognized feature for this target (ignoring feature)
'+sse2' is not a recognized feature for this target (ignoring feature)
'+ssse3' is not a recognized feature for this target (ignoring feature)
'+ssse3' is not a recognized feature for this target (ignoring feature)
warning: undefined symbol: int8_multiply_and_add_bias (referenced by top-level compiled C/C++ code)
warning: undefined symbol: int8_prepare_a (referenced by top-level compiled C/C++ code)
warning: undefined symbol: int8_prepare_b (referenced by top-level compiled C/C++ code)
warning: undefined symbol: int8_prepare_b_from_quantized_transposed (referenced by top-level compiled C/C++ code)
warning: undefined symbol: int8_prepare_b_from_transposed (referenced by top-level compiled C/C++ code)
warning: undefined symbol: int8_prepare_bias (referenced by top-level compiled C/C++ code)
warning: undefined symbol: int8_select_columns_of_b (referenced by top-level compiled C/C++ code)
warning: undefined symbol: pclose (referenced by top-level compiled C/C++ code)
[100%] Built target bergamot-translator-worker
+ bash ../wasm/patch-artifacts-import-gemm-module.sh
Importing integer (8-bit) gemm implementation
SUCCESS
+ set +x

Build complete

  ./build-wasm/bergamot-translator-worker.js
  ./build-wasm/bergamot-translator-worker.wasm
  Uncompressed wasm size: 5.00M (5246440 bytes)
  Compressed wasm size: 1.77M (1856341 bytes)