Python Bytes is a weekly podcast hosted by Michael Kennedy and Brian Okken. The show is a short discussion on the headlines and noteworthy news in the Python, developer, and data science space.
#489 Or JSON?
July 21, 2026
00:30:51
5.24 MB ( 33.42 MB less)
Downloads: 0
Topics covered in this episode:
- django-orjson
- Best Django Redis configuration for speed and size
- Linus Torvalds puts the foot down against Anti-AI Kernel Maintainers
- Django Steering Council backs the Triptych Project
- Extras
- Joke
About the show
Sponsored by us! Support our work through:
- Our courses at Talk Python
- Consulting from Six Feet Up
Connect with the hosts
- Michael: Mastodon / BlueSky / X / LinkedIn
- Calvin: Mastodon / BlueSky / X / LinkedIn
- Show: Mastodon / BlueSky / X
Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Tuesday at 7am PT. Older video versions available there too.
Michael #1: django-orjson
- Adam Johnson dropped
django-orjson- drop-in replacements for the Django and DRF pieces that touch JSON, swapping stdlibjsonfor orjson, the Rust-based library. Headline numbers: 10x faster serialization, 2x faster deserialization. - The interesting question is why this needs to be a package at all.
pip install orjsonis the easy part. Adam's actual pitch: adopting it "isn't easy, especially when your framework usesjsonin many different parts." Django scatters JSON acrossJsonResponse, the test client and test case classes, thejson_scripttemplate tag, and more. There's no single hook to grab, so you get a library that catches them all. - Adam is refreshingly honest about the scale of the win. His words: "While database queries tend to dominate the typical Django application's runtime, the time spent in serialization and deserialization can still be significant." He calls it "a nearly free performance win" - not "this will 10x your app." That's a claim about cost, not magnitude, and it's worth keeping those straight.
- Worth flagging what the post doesn't cover: caveats. There are none in the article, but orjson has real ones. Django and Flask both render datetimes as RFC 822 HTTP-date (
Wed, 15 Jul 2026 12:00:00 GMT); orjson does ISO 8601. It can't doensure_ascii, it rejects NaN and Infinity (which stdlib happily emits), and it raises onDecimal. If you've got a JS client parsing dates, that's a wire-format change. - Who should actually take this? If you're a DRF shop shoveling JSON all day, yes - it's cheap and it's real. If your app mostly renders HTML templates, you're optimizing a slice of runtime that's already near zero.
- The problem Adam's package solves doesn't exist in Flask or Quart. They already centralize every JSON operation -
jsonify,request.get_json(), the test client, the|tojsonfilter - behind one provider object atapp.json. So there's no library to install. It's about ten lines:import orjson from quart.json.provider import JSONProvider # or flask.json.provider class OrjsonProvider(JSONProvider): def dumps(self, obj, **kwargs) -> str: return orjson.dumps(obj).decode() # provider must return str def loads(self, s, **kwargs): return orjson.loads(s) app.json = OrjsonProvider(app)
The numbers on talkpython.fm
- Evaluated it, measured it, and skipped it. The biggest JSON payload we serve is our MCP server returning a cached episode transcript, about 139 KB. Swapping the provider saves 0.119 milliseconds per request. That total response takes 1.1 ms
- We got 4.1x, not 10x - and the reason is the good lesson. Payload shape decides your speedup. The 10x is for structure-heavy data, lots of small keys where stdlib burns time in Python-level dispatch per item. Our hot payload is one giant transcript string, so the work is escaping and memcpy
Calvin #2: Best Django Redis configuration for speed and size
- Peter Bengtsson revisits a classic: his 2017 "Fastest Redis configuration for Django" benchmark now has a 2026 update posted this week.
- The 2017 post pitted django-redis serializers (json, ujson, msgpack, pickle) and compressors (zlib, lzma) against each other; conclusion was msgpack + zlib as the sweet spot - avoid the json serializer, it's fat and slow.
- The 2026 update narrows focus to just compressors: default (no compression),
zlib,lzma, and newcomerzstd. - New results:
lzmacompresses best but is slowest;zstdis the fastest compressor on Ubuntu; differences between them are very small. - Big takeaway across both: compression buys you a lot of space (2–3.5x smaller) for very little speed cost - worth it for Redis where memory is the constraint.
- Caveat from the author: results depend heavily on your data - his test stores short strings of numbers, so benchmark your own workload.
Michael #3: Linus Torvalds puts the foot down against Anti-AI Kernel Maintainers
- Write up on Ars.
- Really good coverage by Maximillian: Time to wake up (for some)
- Torvalds said that “Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away.”
- I agree with Max, putting your head in the sand and waiting for AI to go away will likely mean you won’t be working professionally in software development in the coming years.
- The statement came amid a lengthy thread arguing about the use of Sashiko, an “agentic Linux kernel code review system” that its creators claim can, in tests, independently find 53.6 percent of the bugs that would end up being fixed by human coders in later commits.
- “We’re not forcing anybody to use [LLM tools], but I will very loudly ignore people who try to argue against other people from using it,” Torvalds said.
- “Anybody who points to the problems at AI had better be looking in the mirror and pointing at themselves at the same time,” Torvalds wrote.
Calvin #4: Django Steering Council backs the Triptych Project
- Django Steering Council issued a Letter of Collaboration backing Carson Gross & Alex Petros's funding bid for the Triptych Project - three proposals to make HTML more expressive natively, in every browser.
- The three additions: PUT/PATCH/DELETE methods for forms, button actions (buttons that fire HTTP requests without a wrapping form), and partial page replacement.
- Distills the core ideas from HTMX/Unpoly/Turbo into the HTML standard itself - no JS, no library, nothing to ship or maintain.
- Current focus is button actions (WHATWG #12330):
<button action=/logout method=POST>Logout</button>instead of wrapping a button in a form. - Relevant to Django directly - think the admin submit row and disguised delete links; Django 6.0's template partials were already inspired by these patterns.
- How to help: companies can send non-binding letters of support on letterhead; individuals can read the proposals and weigh in on the WHATWG issues.
Extras
Calvin:
- DOOMQL - A playable first-person shooter whose framebuffer is a SQL query.
Michael:
Joke: Solving all bugs