Crate hytra[][src]

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. TrAdder can 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 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). The FnAcc is a custom trait that we use as a purpose-specific variant of Fn(T, T) -> T.