-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
perf: avoid repeatedly re-parsing frames #27
Conversation
This should reduce the effort on parsing frames by a factor of 4 when operating on a `--full` trace. In that case `ms` will be a list of 4 metrics but we only need to parse the frames once because they are the same in all cases. Also add a couple of comments which weren't obvious to me on first reading.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #27 +/- ##
==========================================
+ Coverage 74.07% 74.08% +0.01%
==========================================
Files 16 16
Lines 1508 1509 +1
Branches 218 219 +1
==========================================
+ Hits 1117 1118 +1
Misses 328 328
Partials 63 63 ☔ View full report in Codecov by Sentry. |
@sparrowt Well spotted! Thanks a lot for your contribution 🙏 . I was thinking that perhaps something like a namedtuple or a dataclass would provide for a better API to collect profiles, instead of a plain list. But that's for another time 🙂 . |
True yes I think that could simplify things at some point!
|
Thanks. I think some sources need to be reformatted with black. Otherwise all seems good! 🙌 |
Ah I missed that check (I thought github was supposed to put all the failing ones at the top of the list...!) sorted now |
@sparrowt just checking whether there's an extra commit that still needs to be pushed to resolve the lining check 🙂 |
Gah, sorted now. I thought I'd made the necessary changes after running black locally but I'd clearly missed one! |
Awesome 🙌 Thanks a lot for your contributions! 🙂 |
Pleasure! In my limited local testing this was a 30% speedup which I'll take any day |
Hi there! Thanks for producing such an excellent tool. This was a small optimisation I spotted while looking at
stats.py
to learn more about the Austin trace/profile file format.This should reduce the effort on parsing frames by a factor of 4 when operating on a
--full
trace, because in that casems
will be a list of 4 metrics but we only need to parse the frames once because they are the same in all cases.Also add a couple of comments in
Metric.parse
which weren't obvious to me on first reading, I hope that's ok.