Comments (3)
Ah, interesting, yeah, we don't get that "for free" like the Go version does because they use signed integers for the counts:
https://github.com/HdrHistogram/hdrhistogram-go/blob/494271c4c016b36c8cee88480288f33b419cf7b0/hdr.go#L306-L309
I think the best way to go about this would be to add a sub: bool
argument to record_n_inner
here:
Line 868 in 7c4a5fa
And if it's true
do saturating_sub
instead of saturating_add
in the three places that's called in that function. Then, add two interface methods unrecord(value: u64)
and unrecord_n(value: u64, n: T)
that call record_n_inner
with the arg being set to true
.
I'd be curious on the impact of this change on the benchmarks. It could be that it's worth marking record_n_inner
as #[inline]
so that record
can remain optimized for the addition case without the extra branch, given how it's often used in hot loops. @marshallpierce may also have thoughts about this.
from hdrhistogram_rust.
If you have time to write up a PR, then yes, I'd love to take a look!
from hdrhistogram_rust.
This feature is important to me... is there willingness to integrate it in if I PR this feature? - I should be able to figure it out based off of @jonhoo 's description.
The only alternative I can really currently see (if I'd like to use this library and I do!!) is to create a new histogram with the entries I desire to remove then to subtract it from the original histogram... a cumbersome and seemingly inefficient way to do it.
from hdrhistogram_rust.
Related Issues (20)
- README instructions say to use 6.0 HOT 1
- Port ValueAtPercentile optimization from Go and C implementations
- How is the performance compared to the C version? HOT 4
- Test failures on Debian i386 HOT 5
- [Break Change] Rename APIs new_with_* to with_* HOT 1
- SyncHistogram::refresh() freezes HOT 4
- Error when iterating over histogram with only zeros HOT 2
- [Breaking change] rename `more()` to something more explicit. HOT 2
- Feature request: support floating-point numbers HOT 5
- Feature Request: Adding Sum to histograms HOT 2
- `fmt::Display` trait for errors HOT 6
- Move to nom 5.0
- Make public deserialize methods `deser_v2` & `deser_v2_compressed` HOT 3
- Publish 7.0.0 to crates.io HOT 2
- Deprecate non-deflate serialization HOT 2
- f32 or i32 support HOT 9
- iter_recorded() method fails to iterate if all the values are zero. HOT 3
- Merge multiple Histograms into 1. HOT 2
- Releasing CLI tool on its own HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hdrhistogram_rust.