Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
97 tokens/sec
GPT-4o
53 tokens/sec
Gemini 2.5 Pro Pro
43 tokens/sec
o3 Pro
4 tokens/sec
GPT-4.1 Pro
47 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

Faster or Slower? Performance Mystery of Python Idioms Unveiled with Empirical Evidence (2301.12633v1)

Published 30 Jan 2023 in cs.SE

Abstract: The usage of Python idioms is popular among Python developers in a formative study of 101 performance-related questions of Python idioms on Stack Overflow, we find that developers often get confused about the performance impact of Python idioms and use anecdotal toy code or rely on personal project experience which is often contradictory in performance outcomes. There has been no large-scale, systematic empirical evidence to reconcile these performance debates. In the paper, we create a large synthetic dataset with 24,126 pairs of non-idiomatic and functionally-equivalent idiomatic code for the nine unique Python idioms identified in Zhang et al., and reuse a large real-project dataset of 54,879 such code pairs provided by Zhang et al. We develop a reliable performance measurement method to compare the speedup or slowdown by idiomatic code against non-idiomatic counterpart, and analyze the performance discrepancies between the synthetic and real-project code, the relationships between code features and performance changes, and the root causes of performance changes at the bytecode level. We summarize our findings as some actionable suggestions for using Python idioms.

User Edit Pencil Streamline Icon: https://streamlinehq.com
Authors (6)
  1. Zejun Zhang (7 papers)
  2. Zhenchang Xing (99 papers)
  3. Xin Xia (171 papers)
  4. Xiwei Xu (87 papers)
  5. Liming Zhu (101 papers)
  6. Qinghua Lu (101 papers)
Citations (10)

Summary

We haven't generated a summary for this paper yet.