# When is JIT Faster Than A Compiler?

DevFeed: [When is JIT Faster Than A Compiler?](<https://devfeed.tech/articles/when-is-jit-faster-than-a-compiler-1676.md>)

Original publisher: [Read original article](<https://shopify.engineering/when-jit-faster-than-compiler>)

Author: Noah Gibbs

Published: 2022-08-11T14:00:02Z

Content type: article

Language: en

Sources: [Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering.md>), [Shopify Engineering - Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering-shopify-engineering.md>)

Topics: [JIT](<https://devfeed.tech/topics/jit.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [jit](<https://devfeed.tech/tags/jit.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [speed](<https://devfeed.tech/tags/speed.md>)

## AI overview

This article explains how interpreters, ahead-of-time compilers, and just-in-time (JIT) compilers differ. It describes how a JIT translates frequently used parts of a running program into native machine code to improve performance, while noting why ahead-of-time compilation can be difficult for languages such as Ruby.

## Source excerpt

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.