Faster or Slower? Performance Mystery of Python Idioms Unveiled with Empirical Evidence

01/30/2023
by   Zejun Zhang, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/23/2023

On Code Reuse from StackOverflow: An Exploratory Study on Jupyter Notebook

Jupyter Notebook is a popular tool among data analysts and scientists fo...
research
10/28/2021

retworkx: A High-Performance Graph Library for Python

Network and graph analysis is a widely applicable field of research, and...
research
03/28/2022

Does Coding in Pythonic Zen Peak Performance? Preliminary Experiments of Nine Pythonic Idioms at Scale

In the field of data science, and for academics in general, the Python p...
research
09/05/2020

Teddy: Automatic Recommendation of Pythonic Idiom Usage For Pull-Based Software Projects

Pythonic code is idiomatic code that follows guiding principles and prac...
research
03/23/2021

What is the Vocabulary of Flaky Tests? An Extended Replication

Software systems have been continuously evolved and delivered with high ...
research
06/06/2020

Scalene: Scripting-Language Aware Profiling for Python

Existing profilers for scripting languages (a.k.a. "glue" languages) lik...
research
07/10/2019

Executability of Python Snippets in Stack Overflow

Online resources today contain an abundant amount of code snippets for d...

Please sign up or login with your details

Forgot password? Click here to reset