#median #values #calculating #structure #random

streaming-median

Provides a structure for calculating median values

1 unstable release

Uses old Rust 2015

0.1.0 Dec 5, 2018

#17 in #median

MIT/Apache

12KB
158 lines

streaming-median

A highly specialized data structure for calculating median values

Note that this library uses unsafe

StreamingMedian only supports a very, very specific use case.

It only supports medians over a range of 64 values. With int generics I could make this arbitrary, but it suits my needs. PRs welcome if you want to add generic integer support.

This crate uses std::mem::uninitialized for some scratch space. I've documented why I believe it to be safe and I've added a number of tests.

Calculating median values over a random set of values, the worst case, is 74ns on my laptop.

Dependencies

~6–14MB
~156K SLoC