frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

The future of Python web services looks GIL-free

https://blog.baro.dev/p/the-future-of-python-web-services-looks-gil-free
69•gi0baro-dev•6d ago

Comments

Waterluvian•3h ago
We already have PyPy and PyPI, so I think we are cosmically required to call Python 3.14 PyPi
coldtea•3h ago
PeePee hee hee
mythrwy•45m ago
You are getting kicked out of the donglegate conference now.
jyscao•1h ago
PiPy is more apt, no?
NeutralForest•2h ago
Nice that someone takes the time to crunch the number, thanks! I know there's some community effort in how to use free-threaded Python: https://py-free-threading.github.io/

I've found debugging Python quite easy in general, I hope the experience will be great in free-threaded mode as well.

mkoubaa•2h ago
I thought WSGI already used subinterpreters that each have their own GIL
theandrewbailey•25m ago
Subinterpreters are part of the Python standard library as of 3.13 (I think?).
ZiiS•22m ago
This needs a lot of RAM with the speed/cores of modern CPUs. A GIL free multi threaded ASGI scales much further.
shdh•2h ago
Hadn’t heard of Granian before, thinking about upgrading to 3.14 for my services and running them threaded now
Zsfe510asG•2h ago
Accessing a global object as the most simple benchmark that in fact exercises the locks still shows a massive slowdown that is not offset by the moderate general speedups since 3.9:

  x = 0

  def f():
      global x
      for i in range(100000000):
          x += i

  f()
  print(x)

Results:

  3.9:        7.1s

  3.11:       5.9s

  3.14:       6.5s

  3.14-nogil: 8.4s
That is a NOGIL slowdown of 18% compared to 3.9, 44% compared to 3.11 and 30% compared to 3.14. These numbers are in line with previous attempts at GIL removal that were rejected because they didn't come from Facebook.

Please do not complain about the global object. Using a pure function would obviously be a useless benchmark for locking and real world Python code bases have far more intricate access patterns.

logicchains•2h ago
>Please do not complain about the global object. Using a pure function would obviously be a useless benchmark for locking and real world Python code bases have far more intricate access patterns.

Just because there's a lot of shit Python code out there, doesn't mean people who want to write clean, performant Python code should suffer for it.

NeutralForest•1h ago
As mentioned in the article, others might have different constraints that make the GIL worth it for them; since both versions of Python are available anyways, it's a win in my book.
mynewaccount00•1h ago
you realize this is not a concern because nobody in the last 20 years uses global?
kg•28m ago
An incrementing global counter is a pretty common scenario if your goal is to have guaranteed-unique IDs assigned to objects within a process, especially if you want them to be sequential too. I've got counters like that in various parts of code I've shipped, typically incremented using atomics.
sillythrowaway7•14m ago
It is a pretty common scenario if you don’t follow almost two decades worth of best practices and suggested alternatives and advice
pphysch•14m ago
Is that global counter really the only dependency? No database connections or anything that would warrant some proper dependency injection?
adamzwasserman•52m ago
I will complain about the global object.

Even though technically, everything in Python is an object, I feel strongly that programmers should avoid OOP in Python like the plague. Every object is a petri dish for state corruption.

Thee is a very solid list of reasons to use pure functions with explicit passing wherever humanly possible, and I personally believe there is no comparable list of reason to use OOP. * Stack-allocated primitives need no refcounting * Immutable structures reduce synchronization * Data locality improves when you pass arrays/structs rather than object graphs * Pure functions can be parallelized without locks

wenc•33m ago
Globals are not commonly used except in retrofit cases of legacy code or in beginner code.

I haven’t seen or used a global more than once in my 20 years of writing Python.

natdempk•1h ago
Really great, just waiting on library support / builds for free threading.

Have people had any/good experiences running Granian in prod?

Spivak•1h ago
> On asynchronous protocols like ASGI, despite the fact the concurrency model doesn't change that much – we shift from one event loop per process, to one event loop per thread – just the fact we no longer need to scale memory allocations just to use more CPU is a massive improvement.

It's nice that someone else recognizes that event loop per thread is the way. I swear if you said this online any time in the past few years people looked at you like you insulted their mother. It's so much easier to manage even before the performance improvements.

rogerbinns•40m ago
C code needs to be updated to be safe in a GIL free execution environment. It is a lot of work! The pervasive problem is that mutable data structures (lists, dict etc) could change at any arbitrary point while the C code is working with them, and the reference count for others could drop to zero if *anyone* is using a borrowed reference (common for performance in CPython APIs). Previously the GIL protected where those changes could happen. In simple cases it is adding a critical section, but often there multiple data structures in play. As an example these are the changes that had to be done to the standard library json module:

https://github.com/python/cpython/pull/119438/files#diff-efe...

This is how much of the standard library has been audited:

https://github.com/python/cpython/issues/116738

The json changes above are in Python 3.15, not the just released 3.14.

The consequences of the C changes not being made are crashes and corruption if unexpected mutation or object freeing happens. Web services are exposed to adversity so be *very* careful.

It would be a big help if CPython released a tool that could at least scan a C code base to detect free threaded issues, and ideally verify it is correct.

btbuilder•26m ago
This is fantastic progress for CPython. I had almost given up hope that CPython would overcome the GIL after first hitting its limitations over 10 years ago.

That being said I strongly believe that because of the sharp edges on async style code vs proper co-routine-based user threads like go-routines and Java virtual threads Python is still far behind optimal parallelism patterns.

Synadia and TigerBeetle Commit $512k USD to the Zig Software Foundation

https://www.synadia.com/blog/synadia-tigerbeetle-zig-foundation-pledge
194•derekcollison•2h ago•39 comments

Making a micro Linux distro (2023)

https://popovicu.com/posts/making-a-micro-linux-distro/
64•turrini•3h ago•17 comments

React vs. Backbone in 2025

https://backbonenotbad.hyperclay.com/
185•mjsu•6h ago•133 comments

Windows 10 Deadline Boosts Mac Sales

https://www.macrumors.com/2025/10/25/windows-10-deadline-boosts-mac-sales/
31•akyuu•36m ago•5 comments

The future of Python web services looks GIL-free

https://blog.baro.dev/p/the-future-of-python-web-services-looks-gil-free
70•gi0baro-dev•6d ago•24 comments

Unlocking free WiFi on British Airways

https://www.saxrag.com/tech/reversing/2025/06/01/BAWiFi.html
447•vinhnx•1d ago•104 comments

The Swift SDK for Android

https://www.swift.org/blog/nightly-swift-sdk-for-android/
609•gok•19h ago•241 comments

People with blindness can read again after retinal implant and special glasses

https://www.nbcnews.com/health/health-news/tiny-eye-implant-special-glasses-legally-blind-patient...
219•8bitsrule•4d ago•61 comments

Valetudo: Cloud replacement for vacuum robots enabling local-only operation

https://valetudo.cloud/
348•freetonik•5d ago•146 comments

DNA reveals the real killers that brought down Napoleon's army

https://www.gavi.org/vaccineswork/dna-reveals-real-killers-brought-down-napoleons-army
43•janandonly•2h ago•44 comments

First shape found that can't pass through itself

https://www.quantamagazine.org/first-shape-found-that-cant-pass-through-itself-20251024/
477•fleahunter•1d ago•133 comments

Key IOCs for Pegasus and Predator Spyware Removed with iOS 26 Update

https://iverify.io/blog/key-iocs-for-pegasus-and-predator-spyware-cleaned-with-ios-26-update
143•transpute•13h ago•87 comments

Context engineering is sleeping on the humble hyperlink

https://mbleigh.dev/posts/context-engineering-with-links/
136•mbleigh•2d ago•58 comments

Study: MRI contrast agent causes harmful metal buildup in some patients

https://www.ormanager.com/briefs/study-mri-contrast-agent-causes-harmful-metal-buildup-in-some-pa...
192•nikolay•19h ago•165 comments

Harnessing America's heat pump moment

https://www.heatpumped.org/p/harnessing-america-s-heat-pump-moment
189•ssuds•19h ago•405 comments

What is intelligence? (2024)

https://whatisintelligence.antikythera.org/
127•sva_•14h ago•81 comments

The State of Machine Learning Frameworks in 2019

https://thegradient.pub/state-of-ml-frameworks-2019-pytorch-dominates-research-tensorflow-dominat...
11•jxmorris12•3d ago•5 comments

I invited strangers to message me through a receipt printer

https://aschmelyun.com/blog/i-invited-strangers-to-message-me-through-a-receipt-printer/
253•chrisdemarco•6d ago•98 comments

Public Montessori programs strengthen learning outcomes at lower costs: study

https://phys.org/news/2025-10-national-montessori-early-outcomes-sharply.html
333•strict9•2d ago•199 comments

The persistence of tradition: the curious case of Henry Symeonis (2023)

https://blogs.bodleian.ox.ac.uk/archivesandmanuscripts/2023/12/13/the-persistence-of-tradition-th...
22•georgecmu•3d ago•1 comments

The geometry of mathematical methods

https://books.physics.oregonstate.edu/GMM/book.html
51•kalind•5d ago•3 comments

Code like a surgeon

https://www.geoffreylitt.com/2025/10/24/code-like-a-surgeon
203•simonw•1d ago•109 comments

Twake Drive – An open-source alternative to Google Drive

https://github.com/linagora/twake-drive
340•javatuts•1d ago•199 comments

Meet the real screen addicts: the elderly

https://www.economist.com/international/2025/10/23/meet-the-real-screen-addicts-the-elderly
218•johntfella•11h ago•220 comments

Diamond Thermal Conductivity: A New Era in Chip Cooling

https://spectrum.ieee.org/diamond-thermal-conductivity
45•rbanffy•4d ago•18 comments

Luau's performance

https://luau.org/performance
49•todsacerdoti•2d ago•10 comments

Euro cops take down cybercrime network with 49M fake accounts

https://www.itnews.com.au/news/euro-cops-take-down-cybercrime-network-with-49-million-fake-accoun...
116•ubutler•9h ago•61 comments

Why formalize mathematics – more than catching errors

https://rkirov.github.io/posts/why_lean/
205•birdculture•6d ago•70 comments

Fast TypeScript (Code Complexity) Analyzer

https://ftaproject.dev/
39•hannofcart•10h ago•16 comments

How to make a Smith chart

https://www.johndcook.com/blog/2025/10/23/smith-chart/
148•tzury•22h ago•26 comments