-
Notifications
You must be signed in to change notification settings - Fork 14
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
fill() performance #57
Comments
This can be solved by moving |
I don't believe that StreamHist uses fixed-width bins, yet is still able to have 5x faster update in pure Python. The README credits https://github.com/grantjenks/sorted_containers, if I understand correctly. |
I probably won't be able to make a significant refactoring soon but... in any case, I'd recommend you to use the "fill_n" method if you can.
Or, more realistically (simulating that the data come from somewhere one by one):
|
My use case is real time, and spikes from
|
Ok, I'll try to optimize the single-value |
Here is a more fair timing of streamhist. Since my previous test filled with a constant value, the compute-intensive merging of bins was never triggered.
That result is just with the the default max bin count of 64. It gets worse quickly as max bins is increased. (Note: overhead of However, physt is not off the hook so easily... I have an implementation working at 12 usec for the same max bin count. More at #58 (comment). |
For the use case of collecting execution time samples during a program run (and ultimately reporting quantiles), I'd like
fill()
to be fairly fast.physt
fill()
execution time seem to be independent of binning strategy (trivially using constant data value in my tests). I was surprised that bin search is implemented vianp.searchsorted()
in all cases, even fixed_width binning.Comparing to (unmaintained) https://github.com/carsonfarmer/streamhist:
(aside: streamhist is quite nice about managing binning and being able to report arbitrary quantiles. Perhaps some of it could be adopted.)
The text was updated successfully, but these errors were encountered: