Skip to content

frontend: Further improve frontend performance (focused on allocations)#959

Merged
flofriday merged 11 commits into
masterfrom
feature/even-further-frontend-improvements
May 15, 2026
Merged

frontend: Further improve frontend performance (focused on allocations)#959
flofriday merged 11 commits into
masterfrom
feature/even-further-frontend-improvements

Conversation

@flofriday

@flofriday flofriday commented May 13, 2026

Copy link
Copy Markdown
Contributor

This time I tried to get the allocation down.
So far the check command on aarch32 now needs 380MB less memory.
Performance wise, this also improves the frontend by 71ms on the spec.

Protocol

Master: 
2378M

After visitor rewrite:
2350M

After interleaved timing recorder: 
2290M

After rewriting some filter method for builtin collection:
2254M

After avoiding creating useless PassTimings in Allocations.
2250M

After improving LetStatement indexof():
2218M

Adding a new constructors for synthetic construction of ast nodes:
2187M

Avoiding redundant ArrayList creation:
2179M

Early Exit annotation checking:
2162M

Avoid redundant identifier path resolution:
2151M

Better traversal through callindexExpr arguments:
2082M

Remove redundant list creatin in AnnotationTable:
2077M

Removing redundant location setting in ViamLowering:
2070M
==> 1849M after rebasing (thanks Johannes)

After rewriting SymbolResolution:
1846M

After Improving Assembly Expansion:
1814

After fixing double expanding:
1765M

Related PRs: #947 #933

@github-actions github-actions Bot added enhancement New feature or request frontend This is frontend related labels May 13, 2026
@flofriday flofriday requested a review from Jozott00 May 13, 2026 20:45
@flofriday flofriday force-pushed the feature/even-further-frontend-improvements branch 2 times, most recently from 6d11af0 to a8603e6 Compare May 13, 2026 21:40
@Jozott00

Copy link
Copy Markdown
Contributor

JFYI: I am waiting with the review till all tests pass

@flofriday flofriday force-pushed the feature/even-further-frontend-improvements branch 5 times, most recently from 8d3f7ff to 06b6fee Compare May 14, 2026 20:52
@flofriday

Copy link
Copy Markdown
Contributor Author

@Jozott00 the tests are finally passing :)

@flofriday flofriday enabled auto-merge May 15, 2026 09:42
@flofriday flofriday force-pushed the feature/even-further-frontend-improvements branch 2 times, most recently from 345ffd6 to 1f12c7c Compare May 15, 2026 12:28
flofriday added 11 commits May 15, 2026 14:30
This approach allocates fewer intermediate lists.
We often want to make copies of nodes (macro expanding) or
create them syntactically. Some of the code reparsed the tokens
again which wasn't needed.
Most definitions don't have any annotations, so avoiding
a lot of work early saves us 15MB here.
Some macros were expanded twice.
This was due to a bug in the macro expander where macro arguments weren't copied properly and so using it twice resulted in only two places pointing to the same node.

The hack fixed that by simply expanding it once again but at great cost to performance and memory allocations.
@flofriday flofriday force-pushed the feature/even-further-frontend-improvements branch from 1f12c7c to ddce04f Compare May 15, 2026 12:30

@Jozott00 Jozott00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@flofriday flofriday merged commit 4a08e59 into master May 15, 2026
13 checks passed
@flofriday flofriday deleted the feature/even-further-frontend-improvements branch May 15, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request frontend This is frontend related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants