LocalStack

Counter refactor trades minor performance for memory efficiency

info
performanceUpdated Nov 14, 2024(via Exa)
Technologies:
How to detect:

The refactored UsageSetCounter is 18% slower (0.236s vs 0.199s for 1M operations) but reduces memory usage by 99.995% (384 bytes vs 8.4MB for 1M operations). Uses itertools.count which is thread-safe in CPython.

Recommended action:

Be aware of the performance trade-off when upgrading to LocalStack 4.0+. The minor performance impact is acceptable given the massive memory savings and prevention of unbounded growth in long-running sessions.