-
Notifications
You must be signed in to change notification settings - Fork 115
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
Properly handle fractional samples #64
Conversation
Codecov Report
@@ Coverage Diff @@
## master #64 +/- ##
=========================================
+ Coverage 77.54% 77.6% +0.06%
=========================================
Files 15 15
Lines 1287 1286 -1
=========================================
Hits 998 998
+ Misses 289 288 -1
Continue to review full report at Codecov.
|
Neat! I wonder what the performance impact of this change is.. Could you try benchmarking with one of the larger data files? Maybe copy its contents into a file several times over and fold that to get a more representative sample? |
Here are the results using a 2GB test file. I ran it multiple times on master
fractional-samples
Looks like there's very little difference in performance, and surprisingly the |
Oh, that's very interesting.. Could you try running it with |
FWIW: I've approved these changes, but would still like |
Here are the master
fractional-samples
|
Okay, that makes a little more sense -- seems like there's a very slight performance regression. I wonder how often fractional samples come up in practice 🤔 The regression is small enough that I think we should merge this though :) |
I think the performance difference is too small to really worry about, but now I'm wondering why there would ever be fractional samples in the first place. I assumed they would come up somewhere since the Perl version handles them, but it doesn't make sense to me. You either got a sample or you didn't. How would you ever get a partial sample? Can you think of any reason fractional samples would exist? |
Doing some digging led me to brendangregg/FlameGraph#12, which implemented this feature upstream. Quoting @timbunce from there:
There's also brendangregg/FlameGraph#79 indicating that someone is using it. That said, in brendangregg/FlameGraph#18 which introduced I actually kind of like the idea of getting rid of support for fractional sample counts. It suggests we should still parse fractional values, but we should discard the fractional part (like we do today) and instead just add support for the One alternative would be to automatically set Thoughts? |
I think I prefer to simply emit a warning for fractional samples and discard them. Maybe we should just close this PR and I'll add support for @jonhoo, are you good with this solution? |
Fixes #43