Posts

EuroPython 2026

·
2 min read

Returning to EuroPython with Alberto Maldonado to share how we cut our flight search engine's execution time from over 4 seconds to under 500 milliseconds by tuning Python's GC, replacing Pydantic with TypedDict, and restructuring how we traverse and parallelize work in AWS Lambda.

Python
Conferences
Serverless
Performance
EuroPython 2026 conference at ICE Kraków, Poland

Our talk “Python on Serverless: Strategies for Peak Performance” has been accepted at EuroPython 2026 in Kraków! I’ll be presenting alongside my colleague Alberto Maldonado.

We deployed Python in serverless environments and quickly hit the performance limits. Serverless systems suffer from startup latency, memory overhead, and repeated object creation. Executions start almost from scratch, and those extra milliseconds compound fast.

We looked into the performance of our flight search engine, ran profilers, and applied targeted optimizations. The results were real: tuning Python’s GC, reducing stop-the-world pauses, and introducing an asynchronous post-execution process cut our execution time from 1.2 seconds to 300 milliseconds, a 4× speedup with just a few tweaks.

The full end-to-end improvement across all techniques: 4.13 seconds → 463 milliseconds.

What We’ll Cover

Our web API processes thousands of flight offers, deserializing, enriching, and transforming them, and every millisecond counts. The talk walks through what we actually found and fixed:

  • Python’s memory model: how dynamic allocation and large JSON parsing differ from lower-level runtimes, and why object creation at scale is expensive
  • GC tuning: disabling collection during handler execution and collecting afterward reduced GC overhead from 756ms to ~260ms
  • Background thread pattern: performing cleanup and logging after the Lambda handler returns to improve perceived latency without breaking correctness
  • Pydantic vs. TypedDict: when static, zero-overhead structures outperform dynamic validation for large payloads
  • Eliminating redundant traversals: how copy-paste loops over nested data compound into measurable latency, and how a combined traversal fixes it
  • Threads over asyncio: when CPU-bound parsing belongs off the event loop, and why asyncio isn’t always the right tool in serverless
  • Precomputed fields: computing expensive per-offer values once rather than repeatedly across the pipeline

While the examples are based on AWS Lambda, the patterns apply to any short-lived Python system, serverless or containerized.

You’ll walk away with tactics you can apply immediately, an understanding of when they matter, and a clearer picture of how to measure their impact.

Explore More

🗓️ Conference website: ep2026.europython.eu

🎤 View the abstract: Talk details on EuroPython