nayaread
HomeFavouritesTopicsSources
HomeFavouritesTopicsSources
NayaRead links to original engineering blogs. All copyright belongs to the respective authors.
Shopify Engineering·Aug 11, 2022·10 min read43

When is JIT Faster Than A Compiler? - Shopify

I had this conversation over and over before I really understood it. It goes: “X language can be as fast as a compiled language because it has a JIT compiler!” “Wow! It’s as fast as C?” “Well, no, we’re working on it. But in theory, it could be even FASTER than C!” “Really? How would that work?” “A JIT can see what your code does at runtime and optimize for only that. So it can do things C can’t!” “Huh. Uh, okay.” It gets hand-wavy at the end, doesn’t it? I find that frustrating. These days I work on YJIT, a JIT for Ruby. So I can make this extremely NOT hand-wavy. Let’s talk specifics. I like specifics. Wait, What’s JIT Again? An interpreter reads a human-written description of your app and executes it. You’d usually use interpreters for Ruby, Python, Node.js, SQL, and nearly all high-level dynamic languages. When you run an interpreted app, you download the human-written source code, and you have an interpreter on your computer that runs it. The interpreter effectively sees the app code for the first time when it runs it. So an interpreter doesn’t usually spend much time fixing or improving your code. They just run it how it’s written. An interpreter that significantly transforms your code or generates machine code tends to be called a compiler. A compiler typically turns that human-written code into native machine code, like those big native apps you download. The most straightforward compilers are ahead-of-time compilers. They turn human-written source code into a native binary executable, which you can download and run. A good compiler can greatly speed up your code by putting a lot of effort into improving it ahead of time. This is beneficial for users because the app developer runs the compiler for them. The app developer pays the compile cost, and users get a fast app. Sometimes people call anything a compiler if it translates from one kind of code to another—not just source

CompilersJava
Read original on shopify.engineering

Discussion around the web

  • Hacker News8 · 3 💬

Score breakdown

  • Technical depth62
  • Practical value30
  • Originality85
  • Writing quality84
  • Source reputation0
  • Recency0
  • External engagement15
  • On-site engagement0

NayaRead shows a summary and links to the original article. The full article is hosted on shopify.engineering.

More like this

The Cloudflare Blog

Building fast interpreters in Rust

Mar 4, 2019·26 min read
The GitHub Blog

From latency to instant: Modernizing GitHub Issues navigation performance

Natalie Guevara·May 14, 2026·13 min read
Yelp Engineering

Optimizing Our Build Times by Migrating from Webpack to Rspack

Benson Pan +1 other·May 20, 2026·1 min read
Shopify Engineering

RubyConf 2021: The Talks You Might Have Missed - Shopify

Mar 2, 2022·12 min read