Python sets and dictionaries can have quadratic-time performance
ibobev
12 points
2 comments
September 08, 2026
Related Discussions
Found 5 related stories in 62.3ms across 5,917 title embeddings via pgvector HNSW
- 6× faster binary search: from compiled code to mechanical sympathy enz · 15 pts · July 12, 2026 · 47% similar
- Static search trees: 40x faster than binary search (2024) lalitmaganti · 82 pts · July 17, 2026 · 39% similar
- Python Polars Cheatsheet (based on our O'Reilly book) jeroenjanssens · 169 pts · August 18, 2026 · 39% similar
- Thinking in Python pjacotg · 124 pts · August 22, 2026 · 38% similar
- Quadrupling code performance with a "useless" if birdculture · 107 pts · July 13, 2026 · 35% similar
Discussion Highlights (2 comments)
0xa2
The map is not the territory.
javcasas
Java's HashMap also has O(log(N)) complexity on hash collision, and that is before memory/cache details. https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.... In fact, some studying on data structures probably leads to the conclusion that it is impossible to guarantee that an unbounded set/map to have access performance under O(log(N)).