Performance characteristics of HdrHistogram Python
masterThe Python implementation of HdrHistogram provides performance characteristics similar to the original Java version. Recording values has a fixed CPU cost and reduced memory usage.
Encoding and decoding are highly optimized using:
- Integrated C extensions: Native C code handles low-level byte encoding, decoding, and addition at native speeds.
- Native compression: Uses
zlibandbase64for efficient wire encoding.
Typical performance benchmarks (in microseconds):
| Operation | Macbook (Intel i7) | Linux (Xeon Gold) |
|---|---|---|
| Record a single value | 1 | 1 |
| Encode typical histogram | 75 | 68 |
| Decode and add | 100 | 110 |
Note: A 'typical histogram' used for these benchmarks is defined as having 30% of 64-bit buckets filled with sequential values, covering a range from 1 usec to 24 hours with 2 digits of precision. Real-world histograms are often sparser, leading to even faster encoding/decoding times.