Expand description
Hytra 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 TrAdder, that
contains an sum.
Hytra has been inspired by Java’s
LongAccumulator,
DoubleAccumulator,
LongAdder
and
DoubleAdder.
Structs§
- TrAcc
- 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 thread/processors.
- TrAdder
- 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
thread/processors.
TrAddercan wrap any primitive integer type.
Traits§
- FnAcc
- 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 theFntrait is not stable, this would not allow to haveTrAccfor an accumulator other than a closure (which makes the type un-namable) or a function pointer (which means dynamic dispatch). TheFnAccis a custom trait that we use as a purpose-specific variant ofFn(T, T) -> T.