A compiler and toolchain infrastructure library for WebAssembly, providing optimization, assembly, disassembly, and conversion utilities.
Binaryen is a C++ compiler and toolchain library designed to make compiling to WebAssembly easy, fast, and effective. It provides a foundational infrastructure for WebAssembly toolchains, offering utilities for optimization, transformation, and analysis of WebAssembly modules. The project focuses on WebAssembly-specific optimizations, parallel code generation, and deterministic tool outputs.
Compiler engineers and toolchain developers building or integrating WebAssembly backends for languages like C/C++, Rust, TypeScript, Haskell, and Kotlin. It is also used by projects like Emscripten, wasm-pack, and AssemblyScript that require WebAssembly optimization and transformation.
Developers choose Binaryen for its high-performance, modular infrastructure that prioritizes ease of integration and WebAssembly-specific optimizations. Its unique selling point is providing a robust set of deterministic tools and an intermediate representation close to WebAssembly, enabling efficient transformations and parallel optimization not always available in general-purpose compilers.
Optimizer and compiler/toolchain library for WebAssembly
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Serves as a backend for multiple languages including C/C++, Rust, TypeScript, and Haskell, as evidenced by integration with Emscripten, wasm-pack, and AssemblyScript.
Features a parallel optimization pipeline with WebAssembly-specific passes like Memory Packing and Inlining, designed to improve code size and speed using all CPU cores.
All tools, such as wasm-opt and wasm-as, produce consistent outputs given the same inputs, ensuring reproducibility in builds and testing.
Offers a simple C API in a single header and JavaScript bindings, allowing easy adoption in various environments for compiling and optimizing WebAssembly.
Binaryen's internal IR differs from WebAssembly in areas like tree structure and type handling, leading to potential code changes in round-trip conversions, as admitted in the README.
Building from source requires CMake, a C++20 compiler, and git submodule initialization, which can be a barrier for quick setup or cross-platform development.
Primarily targets compiler engineers, lacking high-level APIs or GUI tools, so users must understand compiler internals for effective integration, increasing the learning curve.