Comments (5)
In addition to those remarks, I personally would be interested in the Cgo penalty that wasmer incurs, to give an idea of the "worst case" compared to pure Go implementations. For instance, calling from wasmer in a loop, a Go function that increments a number and returns it.
from wasmer-go.
That's a good point. @tiborvass also wrote me about improving the benchmarks to add more insight into the Cgo penalty.
Life AOT (Polymerase)
For benchmarking, we tried to use the Life with Polymerase
(the one that is AOT) and we were unable to get it working.
At the same time, Polymerase
transpiles the wasm code to C to then compile it with clang
as a shared library (source here: https://github.com/perlin-network/life/blob/3010eb89946c347a3d158749b49aafe9bcd26d65/platform/aot_unix.go#L206), which is not ideal since requires clang
to be present.
Because of that requirement we thought not a lot of people will be able to use it on their environments... and that's why we chose to not put more effort into get it working for the benchmark after our first trial.
Further analysis
In order to provide good benchmarks that are not biased we need to measure things like:
- How fast compiles the modules: since it relies on the Wasmer code generation, we can trust the numbers provided here
- How fast is the code at runtime: provided in the benchmarks
- How fast is able to cross boundaries:
- From Wasm to host functions in go
- From go to Wasm functions
The last part is the one that we haven't measured yet, that I think it will be quite valuable for everyone.
What are your thoughts?
Are there any other things that will be useful to measure?
from wasmer-go.
I would like to complete the answer about Life Polymerase. Cranelift is a JIT engine and is the default backend we use since it offers the best tradeoff between compilation-time and execution-time. If we want to get close to native, as Life with Polymerase does by transforming Wasm to C and then compiling it with clang
, then we can use the LLVM Wasmer backend. It brings a slower compilation-time, but an extremely fast execution-time (as fast as native). In the current benchmarks, we wanted to compare apples to apples; hence comparing Life “raw” to Wasmer with Cranelift: Both do not require any third-party softwares to be present. With Polymerase, Life requires clang to be present, and with LLVM, Wasmer requires… LLVM to be present, … or not. It is likely we will generate a dynamic library for Wasmer that already includes LLVM: It largely increases the dylib size, but it is possible.
I wished that, just like Cargo/Rust has a feature
compilation flag, Go could have something similar, but I didn't found a way to do that yet (any clue?). If a compilation flag can be used, then the user could decide what backend Wasmer must use: Singlepass, Cranelift or LLVM. I think it's the best option until we complete backend tiering.
from wasmer-go.
@Hywan I think the differences you're describing are an issue with choosing benchmarks to highlight performance. Apples to apples would be "here are benchmarks between N pure-go wasm runtimes".
JIT is great, but if you're looking for performance and reduced runtime dependencies maybe it would be better to compile your wasm with Life/clang and ship the resulting binary with your Go program: https://github.com/perlin-network/life/blob/57f3819/platform/aot_unix.go#L234-L237
As far as I can tell, this isn't an option with Wasmer (maybe pre-populate the cache?).
The critique (which I think has been heard) is that "go-ext-wasm is much faster than everything else" is an incomplete picture. The use cases for building wasm into Go code are surely varied and there are a variety of pros and cons to each approach.
from wasmer-go.
@Hywan also Cranelift is young, I'm sure it'll be as fast as llvm in no time! 😉
from wasmer-go.
Related Issues (20)
- Why does converting to I32 with a uint32 value panic if the I32 type is sign agnostic?
- How to support simd instructions in wasmer-go?
- Error print?
- Error executing?
- No error print?
- Allocate memory fail?
- mv dir/foo dir/bar: applet not found
- Rename error message error?
- How can i edit a program with golang and build it with tiny-go, then i can get wasm file?
- loop call wasmer instance export func will occur panic
- Multi-value return support
- Memory leaks after upgrading bindings to 3.3.0
- Issue compiling, parses `-lwasmer` flag as directory? HOT 1
- Is this project still maintained? HOT 1
- Can we run Javy compiled JS program with wasmer-go?
- Is it possible to access un-exported data
- WebAssembly translation error: Unsupported feature: proposed simd operator F64x2PromoteLowF32x4
- Executing HTTP Requests from within WASM functions ?
- support setting bytes for stdin HOT 4
- panic: runtime error: invalid memory address or nil pointer dereference HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasmer-go.