When to reach for it:
→ Walking chains built from external API responses or user input
→ Any graph traversal where Set allocation adds real overhead
→ Anywhere the input can't be guaranteed to terminate
→ Skip it when the structure is small and a Set is clearer
Where it already runs:
→ webpack and Vite circular dependency detection
→ npm dependency graph cycle validation
→ V8's garbage collector during heap mark phases
→ HTTP clients guarding against redirect storms
→ Excel and Sheets on large ranges — spreadsheet engines vectorize formula evaluation across thousands of cells. Branch-heavy evaluation would make `=SUM(A1:A100000)` visibly slow.
#codegolf#algorithms#python#programming
FizzBuzz Without Conditionals in Python
`"Fizz" * (n % 3 == 0)` works in Python and most people have never stopped to ask why. String multiplication by a boolean is legal because `True == 1` and `False == 0`. You've been doing branchless selection without knowing it.
→ Stable 4K video playback — H.264/H.265 codecs make pixel-level decisions millions of times per frame. FFmpeg's inner loops are branchless by design; a conditional check would drop frames.
When you call `factorial(10000)` in Python, it returns in milliseconds. That's not because Python is fast — it's because Python's bigint silently switches to Karatsuba multiplication once numbers get large enough. You've been using it without knowing.
#algorithms#math#python
When to reach for it:
→ Multiplying numbers with hundreds or thousands of digits (RSA keys, arbitrary-precision math)
→ Building a bignum library from scratch where you control the multiplication layer
→ Anywhere schoolbook O(n²) multiplication is the bottleneck at scale