Python has become a popular programming language because of its excellent programmability. Many modern software packages utilize Python for high-level algorithm design and depend on native libraries written in C/C++/Fortran for efficient computation kernels. Interaction between Python code and native libraries introduces performance losses because of the abstraction lying on the boundary of Python and native libraries. On the one side, Python code, typically run with interpretation, is disjoint from its execution behavior. On the other side, native libraries do not include program semantics to understand algorithm defects. To understand the interaction inefficiencies, we extensively study a large collection of Python software packages and categorize them according to the root causes of inefficiencies. We extract two inefficiency patterns that are common in interaction inefficiencies. Based on these patterns, we develop PieProf, a lightweight profiler, to pinpoint interaction inefficiencies in Python applications. The principle of PieProf is to measure the inefficiencies in the native execution and associate inefficiencies with high-level Python code to provide a holistic view. Guided by PieProf, we optimize 17 real-world applications, yielding speedups up to 6.3$\times$ on application level.
翻译:Python 代码和本地图书馆之间的相互作用由于位于 Python 和本地图书馆边界的抽象性而导致性能损失。一方面, Python 代码通常使用口译,与执行行为脱节。另一方面,本地图书馆并不包括用于理解算法缺陷的程序词义学。为了了解互动效率低下的情况,我们广泛研究大量以C/C+++/Fortran 书写成的Python软件包,并根据效率低下的根源对其进行分类。我们从Python 代码和本地图书馆之间的相互作用中提取两种常见的低效率模式。根据这些模式,我们开发了PieProf,一个轻量质的配置程序,以精确了解Python 应用程序中的互动效率低下的情况。PieProf 原则是测量本地执行效率低下的情况,并将低效率与高水平的Python 代码联系起来,以提供全方观点。由PieProftime 指导,我们优化了17-deal-worldal应用,我们优化了17-developmental-listational-listational pplistations。