Crate amadeus[][src]

Performant implementations of various streaming algorithms.

This library is a work in progress. See the docs for what algorithms are currently implemented.

See here for a good list of algorithms to be implemented.

As these implementations are often in hot code paths, unsafe is used, albeit only when justified.

This library leverages the following prioritisation when deciding whether unsafe is justified for a particular implementation:

  1. Asymptotically optimal algorithm
  2. Trivial safety (i.e. no unsafe at all or extremely limited unsafe trivially contained to one or two lines)
  3. Constant-factor optimisations



This data structure tracks the n most frequently seen elements in a stream, using only O(n) space. It is approximate.


An iterator over the entries and counts in a MostFrequent datastructure.


Without replacement


Without replacement