Skip to content

(Local)IntHistogram #254

@breezewish

Description

@breezewish

We need to implement a int version for Histogram, like Counter and Gauge, since atomic float implementation (loop + lock cmpxchg) is much slower than native atomic integer instruction (lock add).

For example, according to benchmarks:

test bench_counter_no_labels                          ... bench:          14 ns/iter (+/- 0)
test bench_int_counter_no_labels                      ... bench:           7 ns/iter (+/- 1)

When there is no concurrent write, float atomic implemented via CAS is 1x slower than int atomic.

test bench_counter_no_labels_concurrent_write         ... bench:       5,263 ns/iter (+/- 1,204)
test bench_int_counter_no_labels_concurrent_write     ... bench:         892 ns/iter (+/- 100)

When there is concurrent write, float atomic is 5x slower than int atomic.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions