Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    C

    Chris Fallin

    cfallin.org · Personal blog · on HN since 2020

    Chris Fallin, a compiler engineer, writes about Cranelift, WebAssembly, JavaScript compilation and Rust language design.

    Visit blogRSSHN submissions
    Languages & CompilersSystems & Performance
    What HN says

    HN links it for detailed compiler work, and the author himself joins threads to explain Cranelift's e-graph approach and SpiderMonkey on WASM.

    Stats for nerds
    18HN people shared it
    31linked in comments
    664story points
    Apr 2026last shared
    2023people per year2026

    Top posts on HN

    1. 1
      Cranelift, Part 2: Compiler Efficiency, CFGs, and a Branch Peephole Optimizer
      5 people · 159 points · first shared 2021 · 18 comments on HN
    2. 2
      Cranelift, Part 4: A New Register Allocator
      3 people · 157 points · first shared 2022 · 16 comments on HN
    3. 3
      Cranelift, Part 3: Correctness in Register Allocation
      4 people · 112 points · first shared 2021 · 9 comments on HN
    4. 4
      A New Back End for Cranelift: Instruction Selection
      2 people · 111 points · first shared 2020 · 8 comments on HN
    5. 5
      Compilation of JavaScript to WASM, Part 2: Ahead-of-Time vs. JIT
      1 person · 93 points · first shared 2024 · 8 comments on HN
    6. 6
      Compilation of JavaScript to WASM, Part 3: Partial Evaluation
      5 people · 18 points · first shared 2024 · 1 comments on HN
    7. 7
      Faster JavaScript on WebAssembly: Portable Baseline Interpreter and Future Plans
      4 people · 3 points · first shared 2023 · Discussion on HN
    8. 8
      Path Generics in Rust: A Sketch Proposal for Simplicity and Generality
      3 people · 3 points · first shared 2024 · 1 comments on HN
    9. 9
      Exceptions in Cranelift and Wasmtime
      2 people · 3 points · first shared 2025 · Discussion on HN
    10. 10
      The acyclic e-graph: Cranelift's mid-end optimizer
      2 people · 2 points · first shared 2026 · Discussion on HN

    What HN people wrote when they linked it

    • pizlonatorOct 2024

      Cranelift's reason for using e-graphs is, in my view, that Rust sucks.

      Seriously.

      Consider the slides here, particularly slides 27-30: https://cfallin.org/pubs/egraphs2023_aegraphs_slides.pdf

      They show code for pattern matching IR in their Rust code, and it's awful. I think it's because they can't just have an IR with pointers, because that would violate Rust's rules. So, they need to call goofy helpers to deconstruct the IR. Consequently, a super simple rewrite rule ends up being a full page of gnarly code. That code would be less than half as long, and much easier to parse, if it was in LLVM IR or B3 IR or any other sensible C++ IR.

      Then they show that the egraph rule is "simple". It's certainly shorter than C++ code. But while it is conceptually simpler than their Rust code, it is no conceptually simpler than the same rewrite written in C++. The C++ code for rewrites in either LLVM or B3 is not that much more verbose than the egraph rule, but in a way that makes it easy to understand. Plus, it's code, so it can call any API in the compiler and do any logic it likes - making it inherently more flexible than an egraph.

      So, if they had used a sensible programming language to write their compiler then they wouldn't have needed egraphs as an escape hatch from how bad Rust is.

      And the phase ordering argument for e-graphs is baloney because:

      - Their example of alias analysis, GVN, and RLE assumes the strawman that you put those things in separate phases. Most compilers…

    • RuskyAug 2023

      Zig did go on to apply the same style to their two later IRs, ZIR (https://github.com/ziglang/zig/pull/8266) and AIR (https://github.com/ziglang/zig/pull/9353). These don't look as thoroughly benchmarked (at least not on the PRs) but it looks like they got significant wins there as well.

      Of course Zig is a very different language and its compiler handles a rather different workload. It's totally possible that their approach makes more sense in younger codebases, or with a different source language design, or whatever else. But I also don't think node size tells the whole story- there's a synergy between memory usage, memory layout, and memory access patterns. For example Cranelift gets a lot of mileage from tweaking their algorithms in combination with their data structures, e.g. the "half-move" design mentioned in https://cfallin.org/blog/2022/06/09/cranelift-regalloc2/#performance

    • cfallinMar 2024

      We actually take a fairly unconventional approach to e-graphs: we have a few linear passes and we do all rewrites eagerly, so we use them to provide a general framework for the fixpoint problem into which we plug in all our rewrites, but we don't have the usual "apply as much CPU time as you want to get better results" property of conventional equality saturation.

      I gave a talk about this approach, aegraphs (acyclic e-graphs), here: slides (https://cfallin.org/pubs/egraphs2023_aegraphs_slides.pdf), video (https://vimeo.com/843540328)

      (disclosure: Cranelift tech lead 2020-2022 and main author of the e-graphs mid-end, as well as regalloc, isel and its custom DSL, and other bits, along with the excellent team)

    • phickeyJan 2024

      We have already made big improvements in using SpiderMonkey on WASM, and have more work in progress that will enable SpiderMonkey to have "native"-like codegen for WASM: https://cfallin.org/blog/2023/10/11/spidermonkey-pbl/

      An additional benefit of using a fast JS runtime inside of WASM, even on a WASM engine that natively supports JS, is to use a Wasm Component as a security boundary around JS code. This could be used as an means of isolating supply-chain security issues, or allowing users to provide (untrusted) JS code that extends an existing system while having a clear and strong boundary on how untrusted JS code can affect the host JS code.

    • spankaleeFeb 2024

      QuickJS and SpiderMonkey in WASM don't use JIT though - they're both just interpreters.

      WASM itself is often JIT'ed so a JS-to-WASM compiler that functions like the common JS baseline compilers would still get some benefit of JIT'ing even though the types available to the ICs in WASM may not be as useful as in JS.

      https://cfallin.org/blog/2023/10/11/spidermonkey-pbl/#future-compiled-code has some interesting ideas on enabling the SpiderMonkey baseline compiler for WASM and possibly using partial evaluation to see better types.

    • steveklabnikOct 2024

      For sure. And I do find https://cfallin.org/blog/2024/06/12/rust-path-generics , for example, interesting. It’s certainly not like what Rust does today is the only way things could ever be. Heck, I’m sad we never got elision on structs in 2018 like we were talking about.

    Related

    Jason Moironjmoiron.net36 people

    Go Performance Tales

    Jason Moiron
    Personal · last shared 2026
    The Incredible Holkblog.theincredibleholk.org23 people

    Booting to Rust

    The Incredible Holk
    Personal · last shared 2022
    Matthias Endlerendler.dev45 people

    The best programmers I know

    Matthias Endler
    Personal · last shared 2026
    Bluish Coderbluishcoder.co.nz77 people

    Using Freenet

    Bluish Coder
    Personal · last shared 2025
    Nick Cameronncameron.org65 people

    Rust in 2022

    Nick Cameron
    Personal · last shared 2026
    Brian Andersonbrson.github.io32 people

    Dave Herman’s contributions to Rust

    Brian Anderson
    Personal · last shared 2025
    The Feedback Loopthefeedbackloop.xyz21 people

    Stroustrup's Rule and Layering Over Time in Rust

    The Feedback Loop
    Personal · last shared 2023
    Nick Fitzgeraldfitzgeraldnick.com43 people

    Demangling C++ Symbols in Rust

    Nick Fitzgerald
    Personal · last shared 2024