DigiNews

Tech Watch by Johan Denoyer

← Back to articles

Python sets and dictionaries can have quadratic-time performance

Quality: 8/10 Relevance: 9/10

Summary

The article analyzes Python's dict and set as hash tables and demonstrates that their performance is not strictly constant-time. Through a micro-benchmark, it shows how time grows roughly quadratically as the data set grows, driven by memory access and cache effects. It also discusses the fastconstmap library as a cache-friendly alternative and emphasizes that modeling assumptions (like O(1) for dict) are just simplifications.

🚀 Service construit par Johan Denoyer