mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-22 21:04:27 +01:00
886c8bb647
3891: Fix the way we compute the 99th percentile r=dureuill a=Kerollmops This PR fixes how we compute the 99th percentile by avoiding using float and doing the multiplication and divisions in the correct order avoiding going out of the buffer of timings. You can see the issue on [this rust playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021). When there are a very small number of successful requests, the number is so tiny that the 99th percentile calculus sometimes gives an index out of the buffer. In this example, the `1`/`1.0` represent the number of timings you collected (one). As you can see, the float computation gives us the index `1.0`, with is out of a vector of only one value. This makes the engine generate a `null` value. ```rust 1 * 99 / 100 = 0 // with integers 0.99_f64 * (1.0 - 1.0) + 1.0 = 1.0 // with floats ``` Co-authored-by: Clément Renault <clement@meilisearch.com> |
||
---|---|---|
.. | ||
src | ||
tests | ||
build.rs | ||
Cargo.toml |