Make Python Up to 150× Faster with C
towardsdatascience.com·12w·
Discuss: r/programming

, sooner or later, you’re going to hit a block when it comes to your code execution speed. If you’ve ever written a computationally heavy algorithm in Python, such as string distance, matrix math, or cryptographic hashing, you’ll know what I mean.

Sure, there are times when external libraries like NumPy can come to your rescue, but what happens when the algorithm is inherently sequential? That was precisely my problem when I wanted to benchmark a particular algorithm, which determines the number of edits required to transform one string into another.

I tried Python. I tried NumPy. And then I turned to C, a language I first learned at college decades ago but hadn’t used in anger for about 15 years. That’s where things got interesting.

I first had to answer the question, “Can you…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help