7 Embarrassingly Easy Ways to Speed Up Your Core Python Program
Whoever said there is no ‘free lunch’ ;)
Recently, it dawned on me that I had too many stories started, and with no plan to finish: an embarrassing number of works in progress!
In response, I attempted to clean up, organize, and figure out which pieces had the potential. Of all the top candidates, which will come soon, there were two that were not at the top, but certainly neat topics: (1) a list of core python tricks that speed up code and (2) a philosophical piece on the fundamentals of optimization. Initially, the overlap was minimal, however, after tweaking a bit, and merging as one, I introduce to you the following: a piece that includes a list of Python tricks with some philosophical perspective on the concept of speeding up code.
For those only interested in the list of tricks, and not the story wrapping around it, click here to jump ahead.
So what, who cares?
So what, who cares? When determining the worthiness of delivering on a particular cost, a question should be at the forefront of brainstorming. Put differently, if the what is insignificant, and the who is nonexistent, then why bother. Thus, a simple mechanism for weighing aspects of the reward in the common predicament of meaning risk versus reward: put simply, anyways, as more elaboration is subject to its own blog post — note to self ;)
The purpose of this blog is to share a few code snippets, along with runtimes, as means of hinting at optimal performance if followed. Specifically, five of my favorite Python-specific tips and tricks in the performance.
For those interested, we first will review fundamental concepts and a general recipe to follow when the intention is to speed up your codebase. Following this, we will peak at trend lines to depict the worthiness of mastering Python: if for no other reason, it has grown to be one of the more popular languages, which only continues to extend its power and reach while maintaining its foundation via a loyal consumer-base and open-source criteria. For this, we will do a simple, approximate analysis using Google Trends.
Beyond the remainder of the introduction (i.e., Motivation) section, we then cover the techniques. Finally, we conclude with a discussion and a list of related resources. Comments are not only encouraged but are always highly appreciated. Thank you in advance, and I hope you enjoy it and find it useful!
Finish blog on Medium via Friend Link.