HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
WebAssembly
binaryen
WebAssembly2015–2026
WebAssembly / binaryen

binaryen

Optimizer and compiler/toolchain library for WebAssembly

27Distinct people
37Mentions
0Explicit recommenders
8.7KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Optimizer and compiler/toolchain library for WebAssembly

GitHub

Where it is used

  • aurora-engine — For WebAssembly optimization we use wasm-opt from the Binaryen toolchain for WebAssembly. Source

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 6:01:08 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year37 dated mentions

Observed mentions: 2015-12-17 19:33:40 UTC to 2026-03-14 15:34:22 UTC.

02468102015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 9 mentions; 0 submissions, 9 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC312
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC909
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC404
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC505
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC202
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC202
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC303
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC202
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC303
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Binaryen Binaryen is a compiler and toolchain infrastructure library for WebAssembly, written in C++. It aims to make compiling to WebAssembly easy, fast, and effective: Easy: Binaryen has a simple C API in a single header, and can also be used from JavaScript. It accepts input in WebAssembly-like form but also accepts a general control flow graph for compilers that prefer that. Fast: Binaryen's internal IR uses compact data structures and is designed for completely parallel codegen and optimization, using all available CPU cores. Binaryen's IR also compiles down to WebAssembly extremely easily and quickly because it is essentially a subset of WebAssembly. Effective: Binaryen's optimizer has many passes (see an overview later down) that can improve code size and speed. These optimizations aim to make Binaryen powerful enough to be used as a compiler backend by itself. One specific area of focus is on WebAssembly-specific optimizations (that general-purpose compilers might not do), which you can think of as wasm minification, similar to minification for JavaScript, CSS, etc., all of which are language-specific. Toolchains using Binaryen as a component (typically running wasm-opt) include: Emscripten (C/C++) wasm-pack (Rust) J2CL (Java; J2Wasm) Kotlin (Kotlin/Wasm) Dart (Flutter) wasm_of_ocaml (OCaml) For more on how some of those work, see the toolchain architecture parts of the V8 WasmGC porting blogpost. Compilers using Binaryen as a library include: AssemblyScript which compiles a variant of TypeScript to WebAssembly wasm2js which compiles WebAssembly to JS Asterius which compiles Haskell to WebAssembly Grain which compiles Grain to WebAssembly Binaryen also provides a set of toolchain utilities that can Parse and emit WebAssembly. In particular this lets you load WebAssembly, optimize it using Binaryen, and re-emit it, thus implementing a wasm-to-wasm optimizer in a single command. Interpret WebAssembly as well as run the WebAssembly spec tests. Integrate with Emscripten in order to provide a complete compiler toolchain from C and C++ to WebAssembly. Polyfill WebAssembly by running it in the interpreter compiled to JavaScript, if the browser does not yet have native support (useful for testing). Consult the contributing instructions if you're interested in participating. Binaryen IR Binaryen's internal IR is designed to be Flexible and fast for optimization. As close as possible to WebAssembly so it is simple and fast to convert it to and from WebAssembly. There are a few differences between Binaryen IR and the WebAssembly language: Tree structure Binaryen IR is a tree, i.e., it has hierarchical structure, for convenience of optimization. This differs from the WebAssembly binary format which is a stack machine. Binaryen uses Stack IR to optimize "stacky" code (that can't be represented in structured form). When stacky code must be represented in Binaryen IR, such as with multivalue instructions and blocks, it is represented with tuple types that do not exist in the WebAssembly language. In addition to multivalue instructions, locals and globals can also have tuple types in Binaryen IR but not in WebAssembly. Experiments show that better support for multivalue could enable useful but small code size savings of 1-3%, so it has not been worth changing the core IR structure to support it better. Block input values (currently only supported in catch blocks in the exception handling feature) are represented as pop subexpressions. pops must appear as the first instruction in a catch block (ignoring unnamed blocks around them, as those are not emitted in the binary format). Types and unreachable code WebAssembly limits block/if/loop types to none and the concrete value types (i32, i64, f32, f64). Binaryen IR has an unreachable type, and it allows block/if/loop to take it, allowing local transforms that don't need to know the global context. As a result, Binaryen's default text output is not necessarily valid wasm text. (To get valid wasm text, you can do --generate-stack-ir --print-stack-ir, which prints Stack IR, this is guaranteed to be valid for wasm parsers.) Binaryen supports a stringref type. This is similar to the currently- inactive stringref proposal, with the difference that the string type is a subtype of externref rather than anyref. Doing so allows toolchains to emit code in a form that uses js string builtins which Binaryen can then "lift" into stringref in its internal IR, optimize (for example, a concatenation of "a" and "b" can be optimized at compile time to "ab"), and then "lower" that into js string builtins once more. Blocks Binaryen IR has only one control flow structure that contains a variable-length list of children: the block. WebAssembly on the other hand allows all control flow structures, such as loops, if arms, and function bodies, to have multiple children. In Binaryen IR, these other control flow structures have a single child. This child may of course be a block. The motivation for this property is that many passes need special code for iterating on lists of instructions, so having a single IR node with a list simplifies them. As in the Wasm text format, blocks and loops may have names. Branch targets in the IR are resolved by name (as opposed to nesting depth). This has 2 consequences: Blocks without names may not be branch targets. Names are required to be unique. (Reading .wat files with duplicate names is supported; the names are modified when the IR is constructed). As an optimization, a block with no name, which can never be a branch target, will not be emitted when generating wasm. Instead its list of children will be directly used in the containing control flow structure. Such a block is sometimes called an "implicit block". Reference Types The wasm text and binary formats require that a function whose address is taken by ref.func must be either in the table, or declared via an (elem declare fun
Read the full README on GitHub

What Hacker News says

9 sources
Oh I see, sorry for misunderstanding. Yeah, I think it would have been nice to have text format input support in browsers, but the decision was against that. But you do have other options than emitting binary wasm yourself. You can use a compiled version of wabt or binaryen, here's an example of binaryen.js, https://github.com/WebAssembly/binaryen/blob/master/test/bin... edit: actually it looks like the test doesn't cover WasmBinaryWriter, which is what would be needed for this, we should improve that
In WebAssembly Browser Preview
WABT (https://github.com/WebAssembly/wabt/) and Binaryen (https://github.com/WebAssembly/binaryen) as well as the spec itself (https://github.com/WebAssembly/spec/tree/master/interpreter) all have interpreters for the WebAssembly language. What they don't have is the same import and export binding mechanisms that the JavaScript engines have. JS engines can bind wasm imports and exports with JS functions. The interpreters that exist today are great for testing implementations or compilers but don't have interesting capabilities to interact with an embedding environment. There have been a few experiments with non-JS embeddings (for example, implementations build on LLVM which could easily define bindings to native functions) but nothing really usable or productized yet.
In WebAssembly Browser Preview
As sunfish mentions below, this spec document is being conservative in describing things that are still being discussed. There are experimental implementations in Firefox, Chrome and Edge. See https://webassembly.github.io/demo/. There's more information about the current binary format here: https://github.com/WebAssembly/design/blob/master/BinaryEnco... There's a prototype spec interpreter here: https://github.com/WebAssembly/spec/tree/master/ml-proto There's a build waterfall testing multiple tools here: https://wasm-stat.us/console, including the experimental LLVM toolchain, the emscripten-wasm toolchain[0], binaryen[1], and sexpr-wasm[2]. WebAssembly is still under development, but I don't think it's fair to call it an early prototype. [disclaimer: I'm a WebAssembly contributor] [0]: https://github.com/kripken/emscripten/wiki/WebAssem
Read the rest
In WebAssembly Specification Prototype
The Emscripten toolchain can be used to produce both WebAssembly and asm.js from the same codebase [0]. There are also the nascent beginnings of a translation tool from WebAssembly to asm.js here [1] (look for wasm2asm). Ultimately, it should be possible to write a streaming polyfill for WebAssembly, but no one has gotten around to making anything suitable for production yet. You're better off producing a separate fallback asm.js bundle for now. [0]: https://github.com/kripken/emscripten/wiki/WebAssembly [1]: https://github.com/webassembly/binaryen
In Experimental support for WebAssembly in V8
I had a lot of fun to see that the other day :-) > "Binaryen" is pronounced in the same manner as "Targaryen": bi-NAIR-ee-in. Or something like that? Anyhow, however Targaryen is correctly pronounced, they should rhyme. Aside from pronunciation, the Targaryen house words, "Fire and Blood", have also inspired Binaryen's: "Code and Bugs." https://github.com/WebAssembly/binaryen Do you know XZ Embedded? http://tukaani.org/xz/embedded.html I wonder if it could improve startup (with emterpreter?).
In Brendan Eich: WebAssembly is a game-changer
To be fair, if you have a good read of https://github.com/WebAssembly/binaryen, you'll find the OP is pretty much on the ball; there's no easy way to compile to web assembly from (language here), and even if you do, there isn't really any easy way to run the result other than compiling it back to asm.js ...and yes, asm.js certainly has its fair share of limitations, and problems. but... I’m more interested at this point to see what other approaches to create the new web-based apps of the (near) future have been dreamed up by people so far. Something which does not involve abusing a flawed scripting language’s runtime to do unspeakable things. Like what? What people? Who's actually working on any other solution to this problem? I get that Web Assembly isn't going to solve your need compile a C++ application to run in a
Read the rest
browser without modifying it; but... I'm pretty sure that's not the goal. The goal is to have some way of making extremely high performance parts of a web application, without resorting to an unsafe propriety vendor plugin or breaking backwards compatibility; and (possibly) allowing a new category of 'compile to js' languages to exist that can target web assembly rather than javascript, which (may, arguably) be easier to implement, technically. What's the alternative? Web components? That's been a great success. The polyfill only occasionally destroys firefox and its technically not possible for it to implement some of the features, so lots of people (ie. no one) is using it. Dart? I'm not even going to talk about that. Another browser plugin? Native apps and no more web apps at all? Come on, it's easy to complain, but unless you've got a tangible alternative, cut them a bit of slack. The web assembly stuff is coming along pretty darn fast, and lots of players are involved. It'll be a big deal before you know it; I think it's pretty fair to be excited about it.
In A look at asm.js and the future with WebAssembly

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.