beam
beam copied to clipboard
[BEAM-13015, #21250] Remove looking up thread local metrics container holder and object creation on hot path
This got rid of about half of the overhead of activating the metrics container for the current thread.
The updated implementation is about 48 ms for the two calls to activate:

While the existing implementation is 75 ms (+8 ms not shown for the Closeable#close invocation):

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
- [ ] Choose reviewer(s) and mention them in a comment (
R: @username). - [ ] Mention the appropriate issue in your description (for example:
addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>instead. - [ ] Update
CHANGES.mdwith noteworthy changes. - [ ] If this contribution is large, please file an Apache Individual Contributor License Agreement.
See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI.
R: @steveniemitz
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control
sorry I was OOO last week, I'll take a look at this today!
No, worries. Hopefully you had a good vacation.
No, worries. Hopefully you had a good vacation.
I did, thank you!
this looks good to me, always great to get rid of static state as well.