Streaming Percentiles 3.1.0 Released
Analytics c++ ckms gk javascript percentiles streaming
Published: 2019-03-29
Streaming Percentiles 3.1.0 Released

Version 3.1.0 of the streaming percentiles library has been released.

The streaming percentiles library is a cross-platform, multi-language (C++ and JavaScript) implementation of a number of online (single-pass) percentile algorithms. This version of the streaming percentiles library adds support for copy construction, assignment, move construction, and move assignment on all analytics classes.

This change allows you to put streaming analytics classes into STL containers, such as:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#include <vector>
#include <stmpct/gk.hpp>

std::vector<stmpct::gk<double>> algs;
algs.emplace_back(0.01);
algs.emplace_back(0.05);
for (auto& g : algs) {
    for (int i = 0; i < 1000; ++i) {
        g.insert(rand());
    }

    double p95 = g.quantile(0.95); // Approx. 95th percentile for current epsilon
}

It also allows you to efficiently move the state of an algorithm from one object to another without copying, as in:

1
2
3
4
stmpct::gk<double> g1(0.01);
// Do stuff with g1
auto g2 = std::move(g1);
// g2 now has the previous state of g1, and g1 is now in an unspecified state

To download the latest version of the streaming percentiles library (including documentation), visit https://github.com/sengelha/streaming-percentiles, or get it from NPM at https://www.npmjs.com/package/streaming-percentiles.