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

[RTG][Elaboration] Move ConstantLike check after TypeSwitch for better performance #7998

Open
wants to merge 1 commit into
base: maerhart-rtg-elaboration-perf
Choose a base branch
from

Conversation

maerhart
Copy link
Member

The hasTrait check is quite expensive. Most operations in the IR are likely not constants, thus doing the TypeSwitch and Visitor dispatch first, should lead to better performance in most cases.

Reduces runtime of example in #7986 but with 10x more iterations from ~6.8 sec to ~3.7 sec (1.84x speedup).
Increases runtime of an example containing a single rtg.test containing 10 mio index.constant (and nothing else) from 1.67 sec to 1.85 sec (10% slowdown).

@maerhart maerhart added the RTG Involving the `rtg` dialect label Dec 16, 2024
Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

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

1.84x best case versus 0.9x worst case feels like a nice improvement! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RTG Involving the `rtg` dialect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants