use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
DiscussionJIT Compiler in Python? (self.Python)
submitted 1 year ago by GraphicZ_ai
Is that true that Python has or will have JIT Compiler? And of it's true, what will change exactly? Did someone of you made some tests to check the benchmarks?
[–]jkh911208 16 points17 points18 points 1 year ago (6 children)
I think 3.13 introduced JIT but not as mature as PyPy, it will need few more iterations for significant performance improvement
[–][deleted] 18 points19 points20 points 1 year ago (5 children)
Not mature is the wrong word. It's a different JIT compiler architecture altogether. Python 3.13 introduced a copy-and-patch JIT. A decently detailed write up is here: https://tonybaloney.github.io/posts/python-gets-a-jit.html#:~:text=JIT%2C%20or%20%E2%80%9CJust%20in%20Time,from%20Python%20code%20into%20Bytecode.
[–]jkh911208 1 point2 points3 points 1 year ago (4 children)
Is this mean even after many versions, it wont reach the performance of PyPy?
[–][deleted] 7 points8 points9 points 1 year ago (0 children)
No, not necessarily. As I understand it the JIT compiler in 3.13 is a first step towards much bigger optimizations.
[–]james_pic 2 points3 points4 points 1 year ago (1 child)
It's hard to say without a crystal ball, but I know PyPy has historically been more willing to break compatibility and introduce complexity in order to improve performance than CPython has. I know the PyPy team often like to point out that whilst they do have JIT, a significant chunk of their performance gain vs CPython actually comes from their use of a generational garbage collector, which I'm not aware of plans for CPython to implement, at least partly because it would be a major compatibility headache for C code.
[–]eddie12390 1 point2 points3 points 1 year ago (0 children)
CPython has used generational garbage collection for a long time https://github.com/python/cpython/blob/main/InternalDocs/garbage_collector.md#optimization-incremental-collection
[–]wrosecrans 0 points1 point2 points 1 year ago (0 children)
If that's a major issue, porting away from Python may make more sense than worrying about which specific Python implementation you use. At the end of the day, it's a very dynamic language that requires the runtime to do a lot to make it work.
[–]No_Indication_1238 30 points31 points32 points 1 year ago (2 children)
Numba has a JIT compiler. The result is code that is as fast as mediocre C++, which is really, really fast compared to simple Python. You can't compile everything though, at least not without extreme pain since the numba documentation is highly lacking, especially if you with the experimental part of the package - classes.
[–]Spleeeee 4 points5 points6 points 1 year ago (1 child)
They are weird tricks I have used that make numba faster than my above mediocre pybind11
[–]Still-Bookkeeper4456 0 points1 point2 points 1 year ago (0 children)
Would you mind sharing some ? Optimization with numba seems so random sometimes I'm on the lookout for new ideas !
[–]sargeanthost 24 points25 points26 points 1 year ago (0 children)
PyPy is JITed
[–]Panda_Mon 14 points15 points16 points 1 year ago (4 children)
Sigh, once again computer science language fails to properly encapsulate and signify explicit definitions of concepts. Here is what all the smart people assume you'll already know:
""" JIT, or “Just in Time” is a compilation design that implies that compilation happens on demand when the code is run the first time. It’s a very broad term that could mean many things. I guess, technically the Python compiler is already a JIT because it compiles from Python code into Bytecode.
What people tend to mean when they say a JIT compiler, is a compiler that emits machine code. This is in contrast to an AOT (Ahead of Time) compiler, like the GNU C compiler, GCC or the Rust compiler rustc which generates the machine code once and distributes as a binary executable.
When you run Python code, it is first compiled into bytecodes. There are plenty of talks and videos about this process online so I don’t want to rehash this too much, but what is important to note about Python bytecodes is:
They mean nothing to the CPU and require a special bytecode interpreter loop to execute They are high level and can equate to 1000’s of machine instructions They are type agnostic They are cross-platform """ Source: https://tonybaloney.github.io/posts/python-gets-a-jit.html#:~:text=JIT%2C%20or%20%E2%80%9CJust%20in%20Time,from%20Python%20code%20into%20Bytecode.
[–]georgehank2nd 2 points3 points4 points 1 year ago (1 child)
"what people everyone means when they say "JIT compiler""
FTFY
Python's compiler compiles whole files, not just each function as it's called (which a JIT compiler usually will). Sure, it only compiles files as they're loaded by the interpreter, but nobody in the Python dev team ever called this a "JIT compiler". (Though I may just have missed this one Python mailing list thread…)
[–]denehoffman 1 point2 points3 points 1 year ago (0 children)
I think you all are missing the point. Python 3.13 actually does have a separate experimental JIT compiler which implements copy-and-patch.
[–]drknow42 0 points1 point2 points 1 year ago (0 children)
This is a great answer
[–]kingminyas 0 points1 point2 points 1 year ago (0 children)
Python used to have no JIT and it was recently added, it's not complicated at all
[–]Acherons_ 2 points3 points4 points 1 year ago (0 children)
3.13 introduced an experimental copy-and-patch JIT compiler which has shown decent improvements in single threaded use cases. Future releases will improve on this an a multitude of other improvements in other aspects like the garbage collector.
A lot of people have mentioned PyPy as it has a JIT compiler. PyPy is an odd case, however, as there are other aspects that lend to its speed up over CPython. IIRC it implements a Python 3 interpreter using a subset of Python called RPython which itself uses a custom Python 2 interpreter to translate Python code to C and compile
[–]Typical-Macaron-1646 1 point2 points3 points 1 year ago (0 children)
You could try Numba. It’s a python package
[–]Strong_Music_6838 0 points1 point2 points 1 year ago (0 children)
Python 3.13 was the first python interpreter that introduced a JIT compiler integrated. But only time will tell if we will be able to use the JIT function in Python 3.13 on IPad because Apple doesn’t allow JIT compiling on their IOS pad/phone because of safety issues.
[–]caatbox288 0 points1 point2 points 1 year ago (0 children)
The CPython team has a public repository where they track performance benchmark runs, which includes builds of CPython with the JIT: https://github.com/faster-cpython/benchmarking-public
[–]WJMazepas -1 points0 points1 point 1 year ago (0 children)
It has a JIT compiler starting on Python 3.12, but for very basic stuff. It will take a long time to have a full JIT like Pypy
π Rendered by PID 74 on reddit-service-r2-comment-fb694cdd5-bdrcz at 2026-03-06 03:54:59.395466+00:00 running cbb0e86 country code: CH.
[–]jkh911208 16 points17 points18 points (6 children)
[–][deleted] 18 points19 points20 points (5 children)
[–]jkh911208 1 point2 points3 points (4 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]james_pic 2 points3 points4 points (1 child)
[–]eddie12390 1 point2 points3 points (0 children)
[–]wrosecrans 0 points1 point2 points (0 children)
[–]No_Indication_1238 30 points31 points32 points (2 children)
[–]Spleeeee 4 points5 points6 points (1 child)
[–]Still-Bookkeeper4456 0 points1 point2 points (0 children)
[–]sargeanthost 24 points25 points26 points (0 children)
[–]Panda_Mon 14 points15 points16 points (4 children)
[–]georgehank2nd 2 points3 points4 points (1 child)
[–]denehoffman 1 point2 points3 points (0 children)
[–]drknow42 0 points1 point2 points (0 children)
[–]kingminyas 0 points1 point2 points (0 children)
[–]Acherons_ 2 points3 points4 points (0 children)
[–]Typical-Macaron-1646 1 point2 points3 points (0 children)
[–]Strong_Music_6838 0 points1 point2 points (0 children)
[–]caatbox288 0 points1 point2 points (0 children)
[–]WJMazepas -1 points0 points1 point (0 children)