wasmer/lib
Pekka Enberg 869ac21f7b clif-backend: Eliminate FunctionEnvironment construction in feed_event()
The feed_event() function is called for every wasm binary instruction.
Let's optimize it by storing FunctionEnvironment object in
CraneliftFunctionCodeGenerator, rather than constructing it for every
feed_event() invocation.

This change reduces the time to run "ngix compile" benchmark by 68%:

Before:

  nginx compile           time:   [1.4152 s 1.4186 s 1.4222 s]
  Found 1 outliers among 10 measurements (10.00%)
    1 (10.00%) high mild

After:

  nginx compile           time:   [447.76 ms 448.32 ms 448.80 ms]
                          change: [-68.542% -68.440% -68.352%] (p = 0.00 < 0.05)
                          Performance has improved.

I assume some of the clone() calls are very expensive (Vec::clone(),
likely). I did see libc malloc()/free() high up in "perf top" profiles,
which are eliminted by this change.

I also looked into eliminating FunctionBuilder construction from
feed_event(). That turns out to be painful on lifetime rules because it
borrows bunch of other objects, so I am leaving it for someone who knows
the code better than I do.
2019-08-01 18:06:40 +03:00
..
clif-backend clif-backend: Eliminate FunctionEnvironment construction in feed_event() 2019-08-01 18:06:40 +03:00
dev-utils Prepare for release of 0.5.7 2019-07-23 11:20:59 -07:00
emscripten Remove all uses of mem::uninitialized for Rust 1.38 2019-07-31 13:21:20 +09:00
emscripten-tests Update to wabt 0.9.0. 2019-07-24 10:03:08 -07:00
kernel-loader Update the loader interface for 128 bit types. 2019-07-22 11:23:41 -07:00
kernel-net Remove all uses of mem::uninitialized for Rust 1.38 2019-07-31 13:21:20 +09:00
llvm-backend Merge branch 'master' into features/llvm-windows 2019-07-30 17:38:36 -07:00
middleware-common fix metering benchmark 2019-07-30 15:59:21 +09:00
runtime First working version of LLVM in Windows 2019-07-30 14:47:53 -07:00
runtime-abi Merge branch 'master' into simd 2019-07-23 13:51:15 -07:00
runtime-c-api Merge branch 'master' into simd 2019-07-23 13:51:15 -07:00
runtime-core Remove all uses of mem::uninitialized for Rust 1.38 2019-07-31 13:21:20 +09:00
singlepass-backend Improved Wasmer Backends documentation 2019-07-24 18:06:59 -07:00
spectests Merge branch 'master' into features/llvm 2019-07-30 15:50:55 -07:00
wasi simplify example and make public get_wasi_state unsafe 2019-07-31 15:59:08 +09:00
wasi-tests Prepare for release of 0.5.7 2019-07-23 11:20:59 -07:00
win-exception-handler Prepare for release of 0.5.7 2019-07-23 11:20:59 -07:00
.gitignore Remove generated spectest codes from repo. 2019-01-12 23:48:21 -05:00
README.md Renamed dynasm backend to singlepass 2019-04-11 12:44:03 -07:00

Wasmer Libraries

Wasmer is modularized into different libraries, separated into three main sections:

Runtime

The core of Wasmer is the runtime, which provides the necessary abstractions to create a good user experience when embedding.

The runtime is divided into two main libraries:

  • runtime-core: The main implementation of the runtime.
  • runtime: Easy-to-use API on top of runtime-core.

Integrations

The integration builds on the Wasmer runtime and allow us to run WebAssembly files compiled for different environments.

Wasmer intends to support different integrations:

  • WASI: run WebAssembly files with the WASI ABI.
  • Emscripten: run Emscripten-generated WebAssembly files, such as Lua or nginx.
  • Go ABI: we will work on this soon! Want to give us a hand?
  • Blazor: research period, see tracking issue

Backends

The Wasmer runtime is designed to support multiple compiler backends, allowing the user to tune the codegen properties (compile speed, performance, etc) to best fit their use case.

Currently, we support multiple backends for compiling WebAssembly to machine code:

  • singlepass-backend: Single pass backend - super fast compilation, slower runtime speed
  • clif-backend: Cranelift backend - slower compilation, normal runtime speed
  • llvm-backend: LLVM backend - slow compilation, native runtime speed