Tag: Python
-
HashMap vs Set: Dict Lookups Beat In-Memory Search by 47x
Dict lookups beat list search by 47x in this 100k-element test. But tiny datasets flip the winner โ see the break-even point with benchmarks.
-
asyncio.gather vs as_completed vs TaskGroup: 3 Patterns
gather() killed 49 successful API calls when one failed. Here's when to use as_completed() and TaskGroup instead โ with real latency numbers.
-
Python match-case: 7 Patterns That Beat if-elif Chains
Master Python's match-case with 7 powerful patterns including guard clauses, wildcard matching, and structural destructuring for cleaner code
-
Backtrader vs Zipline: 5-Year S&P 500 Speed & Memory Test
Compare Backtrader vs Zipline in our 5-year S&P 500 benchmark. See which Python backtesting framework wins on speed, memory usage, and efficiency.
-
Rule-Based to ML PHM Migration: 4-Week Python Roadmap
Cut false alarms by 60% and get 2-week failure warnings. Step-by-step migration from threshold rules to ML models with real Python code.
-
Python slots=True: 8x Memory Cut in 10M Dataclass Instances
Cut Python memory usage by 87% with slots=True in dataclasses. Real benchmark: 10 million instances, 8x efficiency gain, zero code complexity added.
-
gc.collect() Slows Python 32%: When Manual GC Hurts
Manual gc.collect() slowed my pipeline 32%. Here's when Python's GC heuristics beat your intuition โ and the rare cases where you should override them.