Fastcounter is an Apache 2.0 licensed fast counter library written in Python. It aims at implementing fast incremental integer with different trade-offs on performance depending on your use case.
It provides 3 classes:
- Counter, a simple integer counter that does not support any concurrency.
- FastWriteCounter, a counter that is thread-safe and is faster at writing than reading.
- FastReadCounter, a counter that is thread-safe and is faster at reading than writing.
Example:
import fastcounter counter = fastcounter.Counter() counter.value # returns 1 counter.increment() counter.value # returns 2