You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user/Performance.md
+14-2Lines changed: 14 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,20 @@ redirect_from:
11
11
12
12
## Execution Performance
13
13
14
-
> TODO: Interpreter speed is slower than CPython, JIT compilation available on
15
-
> Graal, not on OpenJDK, C extensions run at native speeds ...
14
+
GraalPy uses the state-of-the-art just-in-time (JIT) compiler of GraalVM.
15
+
When JIT compiled, GraalPy runs Python code ~4x faster than CPython on the official [Python Performance Benchmark Suite](https://pyperformance.readthedocs.io/).
16
+

17
+
18
+
These benchmarks can be run simply by installing the `pyperformance` package and calling `pyperformance run` on each of CPython and GraalPy.
19
+
To get the Jython numbers, however, the harness and benchmarks was adapted by due to missing Python 3 support in Jyton.
20
+
The speedup was then calculated by taking the pair-wise intersection of working benchmarks and calculating the geomean.
21
+
22
+
Without a JIT compiler, GraalPy currently executes pure Python code around ~4x slower than CPython.
23
+
This means that very short running scripts or scripts running without the Graal compiler on Oracle JDK or OpenJDK are expected to be slower.
24
+
25
+
Many Python packages from the machine learning or data science ecosystems contain C extension code.
26
+
This code benefits little from GraalPy's JIT compilation and suffers from having to emulate CPython implementation details on GraalPy.
27
+
When many C extensions are involved, performance can vary a lot depending on the specific interactions of native and Python code.
0 commit comments