Menu

Post image 1
Post image 2
Post image 3
Post image 4
Post image 5
Post image 6
Post image 7
Post image 8
Post image 9
Post image 10
Post image 11
Post image 12
1 / 12
0

How Python's GIL actually works (and when it bites you)

DEV Community·Athreya aka Maneshwar·23 days ago
#eGHqfH0B
Reading 0:00
15s threshold

Hello, I'm Maneshwar. I'm building git-lrc, a Micro AI code reviewer that runs on every commit. It is free and source-available on Github. Star Us to help devs discover the project. Do give it a try and share your feedback for improving the product. I remember the first time the GIL ruined my evening. I was working on FreeDevTools and had a script that needed to parse, validate, and rewrite metadata for a few hundred thousand small markdown files and finally stores it into sqlite DB. The bulk of my work was pure Python, a lot of looping, dictionary lookups, string concatenation, and small object churn. No NumPy, no Pillow, no native libraries doing the heavy lifting. The single-threaded version was going to take forever, so I did what any reasonable person would do, I threw threads at it. Eight worker threads. Should be a lot faster, right? It was the same speed. Maybe a hair slower. I stared at the terminal for a solid minute thinking I'd done something wrong. I had not done something wrong.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More