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

Open
asl opened this issue Oct 22, 2024 · 0 comments
Open

Annotations incur huge overhead #4974

asl opened this issue Oct 22, 2024 · 0 comments
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
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

No branches or pull requests

1 participant