# JIT Compiler for CPython

**URL:** <https://discourse.julialang.org/t/jit-compiler-for-cpython/108055>\
**Category:** Offtopic\
**Tags:** python\
**Created:** [December 26, 2023, 12:33pm UTC](https://discourse.julialang.org/t/jit-compiler-for-cpython/108055 "2023-12-26T12:33:04Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [January 9, 2024, 4:10pm UTC](https://discourse.julialang.org/t/jit-compiler-for-cpython/108055/4 "2024-01-09T16:10:42Z")

</div>

> [@xiaoxi](#):
>
> Out of curiosity, what are the pros and cons of the Julia JIT compiler versus the Python copy-and-patch JIT compiler?

From the article:

> The initial benchmarks show something of [a 2-9% performance improvement](https://github.com/python/cpython/pull/113465#issuecomment-1876225775).

The basic issue is that it’s hard to efficiently compile Python code because the language semantics weren’t designed for this. There have been many attempts to JIT-compile Python, and some of them have been very sophisticated with impressive results (PyPy, Numba, Pythran, Pyston, …), but generally they have worked well only for a subset of the language. But Python is so widely used that even small speedups (or big speedups on a small subset) are worth the effort, and I wish them well.

It’s for the same reason that you can’t just slap a “Julia backend” underneath Python and expect to see any improvements — a compiler by itself isn’t enough, and Julia’s compiler (which is just ordinary LLVM) isn’t what makes Julia special. This is also a [Julia FAQ](https://docs.julialang.org/en/v1/manual/faq/#Why-don't-you-compile-Matlab/Python/R/%E2%80%A6-code-to-Julia?).

See also many previous discussions — [How hard would it be to implement Numpy.jl, i.e. Numpy in Julia?](https://discourse.julialang.org/t/how-hard-would-it-be-to-implement-numpy-jl-i-e-numpy-in-julia/22080) — [Python to Julia transpiler](https://discourse.julialang.org/t/python-to-julia-transpiler/21473) — [Convert Matlab Code to Julia 1.0](https://discourse.julialang.org/t/convert-matlab-code-to-julia-1-0/21529) — as well as [this blog post](http://www.stochasticlifestyle.com/why-numba-and-cython-are-not-substitutes-for-julia/) by @ChrisRackauckas.

---

_[View the full topic](https://discourse.julialang.org/t/jit-compiler-for-cpython/108055)._
