Skip to content
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

More cached properties to speed up task initialization #487

Closed
wants to merge 0 commits into from

Conversation

copybara-service[bot]
Copy link

More cached properties to speed up task initialization

See PiperOrigin-RevId: 514750195 (364b494) and PiperOrigin-RevId: 515021299 (ce28ad7) for prior art.

metric_objs are instantiated every task registration, regardless of whether this task (or attribute) is actually used. This instantiation uses slow inspect calls.

This CL makes the metric_objs attribute lazy, thus speeding up module imports for users that use the global TaskRegistry pattern.

The speed-up is difficult to characterize (because API usage is so varied), but in some cases I'm seeing 25% faster runtimes.

@copybara-service copybara-service bot force-pushed the test_515095333 branch 2 times, most recently from 9a58bf0 to 23d0f08 Compare March 21, 2023 15:40
@copybara-service copybara-service bot closed this Mar 21, 2023
@copybara-service copybara-service bot deleted the test_515095333 branch March 21, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants