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

Annotations incur huge overhead #4974

Closed
asl opened this issue Oct 22, 2024 · 2 comments · Fixed by #5018
Closed

Annotations incur huge overhead #4974

asl opened this issue Oct 22, 2024 · 2 comments · Fixed by #5018
Labels
compiler-performance Topics on improving the performance of the compiler core. core Topics concerning the core segments of the compiler (frontend, midend, parser)

Comments

@asl
Copy link
Contributor

asl commented Oct 22, 2024

It seems that Annotations / Annotation incur lots of overheads due to cloning during visiting:
Screenshot 2024-10-22 at 12 12 06

As one can see, the Annotations is behind the largest amount of memory allocations (and total size). Annotation itself is also results in large memory overhead.

There are multiple things that contribute to this:

  • Annotation itself is large. It is supposed to be a union of different things (vector of tokens, vector of expressions or indexed vector), but instead it just hold all of them. As a result, Annotation itself is 576 bytes and this is quite large node.
  • Annotations is also large: ~200 bytes, but more importantly it is cloned every time IAnnotated node is visited in the Transform. The reason is simple: while it is optional, it is always initialized to Annotations::empty resulting to explicit copies during visiting.
@asl asl added core Topics concerning the core segments of the compiler (frontend, midend, parser) compiler-performance Topics on improving the performance of the compiler core. labels Oct 22, 2024
@asl asl changed the title Annotations incurs huge overhead Annotations incur huge overhead Oct 22, 2024
@jafingerhut
Copy link
Contributor

@asl Can this issue be closed now that #4992 is merged?

@asl
Copy link
Contributor Author

asl commented Nov 11, 2024

@asl Can this issue be closed now that #4992 is merged?

Not yet. Annotation itself is still huge. Fix is WIP :)

@asl asl linked a pull request Nov 13, 2024 that will close this issue
@asl asl closed this as completed in #5018 Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-performance Topics on improving the performance of the compiler core. core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants