|
| 1 | +# Frequently Asked Questions |
| 2 | + |
| 3 | +### Does module/package XYZ work on GraalPython? |
| 4 | + |
| 5 | +It depends, but is currently unlikely. Our first goal with GraalPython was to |
| 6 | +show that we can run NumPy and related packages using the managed GraalVM LLVM |
| 7 | +implementation. Now that we have done so we are hard at work to improve the |
| 8 | +number of passing CPython unittests. We are also beginning to track our |
| 9 | +compatibility with popular PyPI packages and expect to increase our coverage |
| 10 | +there soon. |
| 11 | + |
| 12 | +### Can GraalPython replace my Jython use case? |
| 13 | + |
| 14 | +We hope it can, but there are some caveats, like Python code subclassing Java |
| 15 | +classes or use through the `javax.script.ScriptEngine` not being |
| 16 | +supported. Please see our [migration document](./JYTHON) for details. |
| 17 | + |
| 18 | +### Do I need to compile and run native modules as LLVM bitcode to use GraalPython? |
| 19 | + |
| 20 | +If you want to run C extensions or use certain built-in features, yes, you need |
| 21 | +to run them compiled to LLVM bitcode. However, many of the core features of |
| 22 | +Python, including large parts of the `os` API, are implemented in Java so many |
| 23 | +standard library modules and packages work without requiring running LLVM |
| 24 | +bitcode. |
| 25 | + |
| 26 | +### Can I use GraalVM sandboxing features with GraalPython? |
| 27 | + |
| 28 | +Yes! As an embedder, you can selectively disable features. As an example, you |
| 29 | +can disable native code execution or filesystem access. If you are a user of |
| 30 | +GraalVM Enterprise Edition, you will also find that the managed execution mode |
| 31 | +for LLVM fully works for running extensions such as NumPy in a safer manner. |
| 32 | + |
| 33 | +### Do all the GraalVM polyglot features work? |
| 34 | + |
| 35 | +We are doing our best to ensure the polyglot features of GraalVM work as a |
| 36 | +Python user would expect. There are still many cases where expectations are |
| 37 | +unclear or where multiple behaviors are imaginable. We are actively looking at |
| 38 | +use cases and are continuously evolving the implementation to provide the most |
| 39 | +convenient and least surprising behavior. |
| 40 | + |
| 41 | +### What is the performance I can expect from GraalPython? |
| 42 | + |
| 43 | +For pure Python code, performance after warm-up can be expected to be around 5-6 |
| 44 | +times faster than CPython 3.8 (or 6-7x faster than Jython). For native |
| 45 | +extensions running as LLVM bitcode, we are currently slower than CPython - you |
| 46 | +can expect to see between 0.1x and 0.5x performance. |
| 47 | + |
| 48 | +### I heard languages with JIT compilers have slow startup. Is that true for GraalPython? |
| 49 | + |
| 50 | +It depends. When you use the GraalVM native image feature with GraalPython or |
| 51 | +use the GraalPython launcher in GraalVM its startup is competitive with |
| 52 | +CPython. In any case, both with native image or when running on JVM we first |
| 53 | +need to warm up to reach peak performance. This is a complicated story in |
| 54 | +itself, but in general it can take a while (a minute or two) after you have |
| 55 | +reached and are running your core workload. We are continuously working on |
| 56 | +improving this |
| 57 | + |
| 58 | +### Can I share warmed up code between multiple Python contexts? |
| 59 | + |
| 60 | +Yes, this works, and you will find that starting up multiple contexts in the |
| 61 | +same engine and running the same or similar code in them will get increasingly |
| 62 | +faster, because the compiled code is shared across contexts. However, the peak |
| 63 | +performance in this setup is currently lower than in the single context case. |
0 commit comments