-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve CKMS performance #21
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit introduces the [criterion](https://github.com/japaric/criterion.rs) library into quantiles. The intention is to tackle CKMS performance again. Signed-off-by: Brian L. Troutwine <[email protected]>
This commit cuts the size of Entry a by 64 bits, shaving milliseconds off the 10k benchmark run. We're still waaaay too slow for 65k to really notice a good difference there. Signed-off-by: Brian L. Troutwine <[email protected]>
Time to wrap it up. I'll have to shop this around to folks that have a better handle on wacky tricks and/or know of a DS of greater applicability than Vec. I am stuck for sure. Signed-off-by: Brian L. Troutwine <[email protected]>
This commit is inspired by the discussion [here](https://users.rust-lang.org/t/how-can-i-optimize-this-data-structure/14273/7). I'm not sure yet how well it does, benchmark wise. Signed-off-by: Brian L. Troutwine <[email protected]>
In this commit we're set to run comparative benchmarks for Vec and Store. The results were not promising, with Vec mean being 493ms and Store mean being 546. Better SD and MAD on Vec too. The computation of 'r' can be stored at the top of each inner store and we can keep a sorted buffer for insertion. I guess the thing to do is benchmark Vec against Store, see where we end up. Signed-off-by: Brian L. Troutwine <[email protected]>
This commit moves CKMS fully onto store with the understanding that the current implementation is pokier than just plain Vec on account of iteration on insertion. The expectation is that we can resolve this. Benchmarking -- not shown -- indicates that Store can do inserts about twice as fast as Vec _if_ we don't have to seek over the whole thing before inserting. Signed-off-by: Brian L. Troutwine <[email protected]>
This commit goes quite a ways toward making 'stores' a proper backing store for CKMS. We just need AddAssign going again. Signed-off-by: Brian L. Troutwine <[email protected]>
Signed-off-by: Brian L. Troutwine <[email protected]>
I've removed sum from the interface of CKMS because if the type is especially small I don't have a wrapping_add available to me. Oops. Up to the client to keep track of this, as a result. Well, maybe if I look into Wrapping? Anyway! We're now on a good footing to benchmark this thing. Signed-off-by: Brian L. Troutwine <[email protected]>
Signed-off-by: Brian L. Troutwine <[email protected]>
I've backed off the use of criterion for now since I couldn't figure out how to slot it into our existing macro-based benchmark generation. This _should_ now pass CI. Signed-off-by: Brian L. Troutwine <[email protected]>
This commit adds the last bit of polish to store.rs in terms of commenting on its function. We also introduce fuzz tests for inspecting the CKMS implementation. -max_len=160 ought to be in place for the existing fuzz test. Signed-off-by: Brian L. Troutwine <[email protected]>
pulltab
approved these changes
Dec 11, 2017
tsantero
approved these changes
Dec 11, 2017
For future reverence: Benchmark e027030
Benchmark 0c6563c (0.6.3)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This series of commits improves the baseline CKMS insertion performance by about 80%. This work was inspired by the needs of postmates/cernan users who set the Prometheus sink summary window to longer than a few seconds, filling a CKMS with > 100k points. This resulted in hangups from the Prometheus aggregator on account of the long delay in responding to it.
The interface for CKMS has slightly changed: we no longer provide
CKMS::sum
. This is done because it was not clear what the behaviour of sum should be at the wrapping boundary of the input type and was felt that this is better handled by users requiring sum. We retain the continuous moving average of inputs.Related reading: https://users.rust-lang.org/t/how-can-i-optimize-this-data-structure/14273/