A beast that eats your data from many threads.
The main type in this library is
TrAcc, which allows you to accumulate data in a single
variable from multiple threads extremely fast. A specialized version is
contains an sum.
Hytra has been inspired by Java’s
The threaded accumulator allows to accumulate data in a single state from multiple threads
without contention, which allows performance to scale well with the number of
The threaded add allows to increment and decrement an integer from multiple threads without
contention, which allows performance to scale well with the number of
TrAdder can wrap any primitive integer type.
This is workaround for the fact that the Fn trait is not stable.
We could have
TrAcc<T, F: Fn(T, T) -> T>. However, since the
Fn trait is not stable, this
would not allow to have
TrAcc for an accumulator other than a closure (which makes the type
un-namable) or a function pointer (which means dynamic dispatch).
FnAcc is a custom trait that we use as a purpose-specific variant of
Fn(T, T) -> T.