# WXWebAssembly

WXWebAssembly Similar to the Web standard WebAssembly can improve the performance of Mini programs to a certain extent.

From the base library v2.13.0 Start, the Mini Program can access it globally and use the WXWebAssembly Object.

From the base library v2.15.0 To start, the Mini Program supports in Worker Internal use WXWebAssembly。

# WXWebAssembly.instantiate(path, imports)

And Standards WebAssembly.instantiate Except that the first argument takes only one character stringCode package path, point to the code package .wasm file

# and WebAssembly Similarities and differences

  1. WXWebAssembly.instantiate(path, imports) Method, the path is the path within the code package (.wasm and.wasm.br suffixes are supported)
  2. Support WXWebAssembly.Memory
  3. Support WXWebAssembly.Table
  4. Support WXWebAssembly.Global
  5. export Functions, Memory, Table, iOS Platform not supported Global

# Other Notes

  • about WebAssembly The documentation can refer to the https://webassembly.org /
  • Base library v2.14.0 After that, a few more were added. WXWebAssembly Characteristic
    • The code package path allows incoming brotli Compressed wasm Documents, such as .wasm.br
    • Increase the number of WXWebAssembly.Global The support of
  • Mini Program plug-in from the base library v2.18.1 Start support WXWebAssembly
  • in Worker Internal use WXWebAssembly When,.wasm Documents need to be placed in the worker Outside the directory, because worker The directory will only be packed .js Documents, Non .js Files will be ignored
  • From WeChat 8.0.25 Start support SIMD Characteristic

# Q&A

  1. Compiled. .wasm If the size is too large, what should I do if I exceed the code package size limit?
  • Method 1: Put a wasm File split into multiple wasm File, and then take advantage of the sub-load capacity to reduce the first packet volume
  • Method 2: Use brotli compress wasm file