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

Coref: Optimize SpanResolver.set_annotations #20

Merged
merged 2 commits into from
Aug 26, 2022

Conversation

shadeMe
Copy link
Contributor

@shadeMe shadeMe commented Aug 25, 2022

Coerce scalar tensors to native Python integers to avoid comparison overhead.

With the above change (and another optimization to SpanGroups.copy; PR), we see a 90% reduction in execution time of the set_annotation pipeline phase.

Before

Screenshot_20220825_154448

After

Screenshot_20220825_154626

Coerce scalar tensors to native Python integers to avoid comparison overhead.
Copy link
Contributor

@polm polm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! I've never seen a simple cast have such a big impact.

@polm polm merged commit de5e533 into explosion:feature/coref Aug 26, 2022
@shadeMe shadeMe deleted the refactor/coref-perf branch August 26, 2022 08:27
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.

2 participants