arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2006.03879cs.PLcs.SE
收藏

Scalene:Python的脚本语言感知分析

Scalene: Scripting-Language Aware Profiling for Python

Emery D. Berger

摘要:

脚本语言的现有分析器(也称为像Python这样的“胶水”语言(“glue”languages)存在许多问题,这些问题严重限制了它们的实用性。它们强加了数量级的开销,报告信息的粒度太粗,或者在面对线程时失败。更糟糕的是,过去的分析器-基本上是C语言的变体-没有注意到这样一个事实,即优化脚本语言中的代码需要有关跨越脚本语言和编译语言编写的库之间鸿沟的代码的信息。本文介绍了脚本语言感知的概要分析,并提出了Scalene,脚本语言感知的Python概要分析的实现。Scalene结合了字节码的采样、推断和反汇编,从而有效而精确地将执行时间和内存使用归因于Python(开发人员可以优化)或库代码(开发人员无法优化)。它包括一个新颖的采样内存分配器,以低开销报告行级内存消耗和趋势,帮助开发人员减少内存占用并识别泄漏。最后,它引入了一个新的度量标准,复制量,以帮助开发人员消除跨Python/库边界的潜在复制成本,这可能会大大降低性能。Scalene适用于单线程或多线程的Python代码,非常精确,以行粒度报告详细信息,同时带来适度的开销(26%-53%)。

英文摘要:

Existing profilers for scripting languages (a.k.a. "glue" languages) like Python suffer from numerous problems that drastically limit their usefulness. They impose order-of-magnitude overheads, report information at too coarse a granularity, or fail in the face of threads. Worse, past profilers---essentially variants of their counterparts for C---are oblivious to the fact that optimizing code in scripting languages requires information about code spanning the divide between the scripting language and libraries written in compiled languages. This paper introduces scripting-language aware profiling, and presents Scalene, an implementation of scripting-language aware profiling for Python. Scalene employs a combination of sampling, inference, and disassembly of byte-codes to efficiently and precisely attribute execution time and memory usage to either Python, which developers can optimize, or library code, which they cannot. It includes a novel sampling memory allocator that reports line-level memory consumption and trends with low overhead, helping developers reduce footprints and identify leaks. Finally, it introduces a new metric, copy volume, to help developers root out insidious copying costs across the Python/library boundary, which can drastically degrade performance. Scalene works for single or multi-threaded Python code, is precise, reporting detailed information at the line granularity, while imposing modest overheads (26%--53%).

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑