WebAssembly/binaryen

Optimizer and compiler/toolchain library for WebAssembly

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 41 minutes ago
Added to GitGenius on November 14th, 2024
Created on October 29th, 2015
Open Issues & Pull Requests: 569 (+0)
GitHub issues: Enabled
Number of forks: 884
Total Stargazers: 8,623 (+0)
Total Subscribers: 173 (+0)

Repository Insights (GitGenius)

Most active contributors

Sign in to see contributor activity.

Related repositories by overlapping contributors

No overlapping-contributor repos identified yet.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

Binaryen is a compiler and toolchain infrastructure library for WebAssembly written in C++. It functions as both a standalone optimizer and a component library used by multiple major language toolchains. The project is designed around three core principles: making compilation to WebAssembly easy through simple APIs, fast through parallel processing and compact data structures, and effective through numerous optimization passes that reduce code size and improve performance.

The repository serves as a critical infrastructure component for the WebAssembly ecosystem. Major toolchains integrate Binaryen as a component, including Emscripten for C/C++ compilation, wasm-pack for Rust, J2CL and J2Wasm for Java, Kotlin/Wasm, Flutter for Dart, and wasm_of_ocaml for OCaml. Additionally, several compilers use Binaryen as a library, including AssemblyScript which compiles TypeScript variants to WebAssembly, wasm2js which converts WebAssembly to JavaScript, Asterius for Haskell compilation, and Grain for its own language compilation.

The core of Binaryen is its intermediate representation, which is designed to be both flexible for optimization and closely aligned with WebAssembly itself. The IR uses a tree structure rather than a stack machine format, making it convenient for optimization passes while remaining simple to convert to and from WebAssembly binary format. Binaryen IR includes features not present in standard WebAssembly, such as an unreachable type and support for tuple types in multivalue contexts, which enable local transformations without requiring global context awareness.

Beyond optimization, Binaryen provides comprehensive toolchain utilities. It can parse and emit WebAssembly, allowing users to load WebAssembly, optimize it, and re-emit it as a wasm-to-wasm optimizer. The library includes a WebAssembly interpreter capable of running spec tests, integrates with Emscripten for complete C and C++ compilation pipelines, and can polyfill WebAssembly by running it in a JavaScript-compiled interpreter for browsers lacking native support.

The project maintains active development with significant contributor engagement.

The repository's classification spans binary optimization, compilation tools, static analysis, testing frameworks, debugging, bytecode manipulation, transpilers, LLVM backend integration, validation, and verification. This breadth reflects Binaryen's role as a comprehensive WebAssembly infrastructure library.