metaopt / optree

OpTree: Optimized PyTree Utilities
https://optree.readthedocs.io
Apache License 2.0
136 stars 6 forks source link

perf: intern cached `str` objects #109

Closed XuehaiPan closed 9 months ago

XuehaiPan commented 9 months ago

Description

Describe your changes in detail.

Intern cached string literals to speed up Python internal dictionary lookup.

Checklist

Go over all the following points, and put an x in all the boxes that apply. If you are unsure about any of these, don't hesitate to ask. We are here to help!

codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (abb03ab) 100.00% compared to head (16112fb) 100.00%.

:exclamation: Current head 16112fb differs from pull request most recent head d4aef3d. Consider uploading reports for the commit d4aef3d to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #109 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 8 8 Lines 708 708 ========================================= Hits 708 708 ``` | [Flag](https://app.codecov.io/gh/metaopt/optree/pull/109/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=metaopt) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/metaopt/optree/pull/109/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=metaopt) | `100.00% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=metaopt#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.