Skip to content

Commit 865c7bb

Browse files
committed
fill in some docs TODO, skip the others for now
1 parent 00663c4 commit 865c7bb

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

docs/user/Native-Images-with-Python.md

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,7 @@ Every embedded application is different and the code pulled in by the rest of th
9494

9595
## Shipping Python Packages
9696

97-
> TODO: Explain stdlib is copied next to binary by default
97+
Our Maven archetype by default is set up to include all needed Python files in the native binary itself, so the image is self-contained.
9898

99-
> TODO: Explain we provide a VirtualFileSystem implementation to include resources
100-
101-
> TODO: Explain how packages can be included as resources, that native extensions are extracted to java.io.tmpdir as needed
102-
103-
## Profile Guided Optimization and AOT Compilation
104-
105-
> TODO: Explain about PGO
106-
107-
> TODO: Explain about Truffle Aux Engine Caching
99+
In custom embeddings, the Python standard library is copied next to the native image.
100+
When moving the native image, the standard library folder needs to be kept next to it.

docs/user/Performance.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,20 @@ redirect_from:
1111

1212
## Execution Performance
1313

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+
![](docs/performance.svg)
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.
1628

1729
## Code Loading Performance and Footprint
1830

0 commit comments

Comments
 (0)