GraalPy – 适用于 Java 的高性能嵌入式 Python 3 运行时
GraalPy – A high-performance embeddable Python 3 runtime for Java

原始链接: https://www.graalvm.org/python/

将 Java 中的 Python 与 GraalVM 结合使用 GraalPy 将 Python 数据科学库的世界引入了 Java 和 GraalVM 上运行的其他语言。 使用 GraalVM 的多语言接口,现在比以往任何时候都更容易将 Python 代码嵌入到 Java 应用程序中,并且具有良好的启动性能! Oracle GraalVM 还包括沙盒选项,用于在托管 Java 应用程序中运行 NumPy、SciPy 或 Matplotlib 等 Python 本机扩展。

为了确保在性能评估期间各种编程语言的结果一致,最好使用使用定义规则的标准化基准测试套件。 “Are-We-Fast-Yet”侧重于通过考虑一组有限的核心语言功能和抽象来比较语言实现的速度。 目标是分离编译器和运行时优化的影响。 在像 Python 这样的情况下,它严重依赖外部函数接口 (FFI) 的外部 C 或本机语言实现,自我实现的集合提供了有关解释器效率的见解。 如果没有这些自定义集合,测试结果可能会根据委托给 FFI 的计算任务的范围而波动。 然而,此类基准测试可能会导致用户相信他们正在测量运行时环境的实际行为,从而由于抽象而提供误导性结果。 用户更喜欢使用语言(例如 dict)提供的内置函数来满足他们的需求,并且与其他运行时环境中的实现相比,不关心特定功能的纯 Python 版本的改进,因为他们的重点仍然主要放在本机代码上。 Consequently, such discrepancies between claimed and experienced performance enhancements often discourage acceptance of new solutions。 Recent trends in data science have shifted attitudes towards Python as the interest in Machine Learning (ML), Computer Unified Device Architecture (CUDA), Metal/MLX, Pytorch, TensorFlow, Language Model Encoder/Decoder tools, among others, increases。 While current Python performance remains suboptimal compared to some other programming languages, the availability of JIT stories promises potential improvement for future Python iterations。 Nevertheless, concerns persist related to the resistance shown by some members of the Python community to prioritize performance optimization efforts, resulting in Python remaining the final significant dynamic language yet to adopt JITs fully。 Ultimately, Python serves as an efficient glue language that facilitates integration with numerous other technologies, including GPU acceleration systems, while boasting a simple and straightforward syntax that enables quick learning。 Additionally, extensive depth is available for more intricate projects should developers desire it。 Although Type Annotations initially introduced irritants pertaining to typing, their presence minimizes such challenges significantly。 The simplicity and versatility offered by Python contribute to its continued popularity。
相关文章

原文

Using Python from Java with GraalVM

GraalPy brings the world of Python data science libraries to Java and other languages running on GraalVM. Using GraalVM's polyglot interfaces, it is now easier than ever to embed Python code in Java applications and with good performance to boot! Oracle GraalVM also includes sandboxing option to run Python native extensions like NumPy, SciPy, or Matplotlib in a managed Java application.
联系我们 contact @ memedata.com