DeepAI AI Chat
Log In Sign Up

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

03/28/2022
by   Pattara Leelaprute, et al.
Nara Institute of Science and Technology
ku.th
Kasetsart University
0

In the field of data science, and for academics in general, the Python programming language is a popular choice, mainly because of its libraries for storing, manipulating, and gaining insight from data. Evidence includes the versatile set of machine learning, data visualization, and manipulation packages used for the ever-growing size of available data. The Zen of Python is a set of guiding design principles that developers use to write acceptable and elegant Python code. Most principles revolve around simplicity. However, as the need to compute large amounts of data, performance has become a necessity for the Python programmer. The new idea in this paper is to confirm whether writing the Pythonic way peaks performance at scale. As a starting point, we conduct a set of preliminary experiments to evaluate nine Pythonic code examples by comparing the performance of both Pythonic and Non-Pythonic code snippets. Our results reveal that writing in Pythonic idioms may save memory and time. We show that incorporating list comprehension, generator expression, zip, and itertools.zip_longest idioms can save up to 7,000 MB and up to 32.25 seconds. The results open more questions on how they could be utilized in a real-world setting. The replication package includes all scripts, and the results are available at https://doi.org/10.5281/zenodo.5712349

READ FULL TEXT

page 1

page 2

page 3

page 4

04/20/2020

Incorporating External Knowledge through Pre-training for Natural Language to Code Generation

Open-domain code generation aims to generate code in a general-purpose p...
01/30/2023

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

The usage of Python idioms is popular among Python developers in a forma...
12/04/2022

Visualizing Contributor Code Competency for PyPI Libraries: Preliminary Results

Python is known to be used by beginners to professional programmers. Pyt...
01/12/2018

High-level python abstractions for optimal checkpointing in inversion problems

Inversion and PDE-constrained optimization problems often rely on solvin...
05/18/2016

An Introduction to Programming for Bioscientists: A Python-based Primer

Computing has revolutionized the biological sciences over the past sever...
11/26/2022

Approaches to the Parallelization of Merge Sort in Python

The theory of divide-and-conquer parallelization has been well-studied i...
05/27/2019

DockerizeMe: Automatic Inference of Environment Dependencies for Python Code Snippets

Platforms like Stack Overflow and GitHub's gist system promote the shari...