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

Feature/memory #4223

Merged
merged 5 commits into from
Apr 11, 2023
Merged

Feature/memory #4223

merged 5 commits into from
Apr 11, 2023

Conversation

jimidle
Copy link
Collaborator

@jimidle jimidle commented Apr 11, 2023

feat: Memory usage improvements, performance and statistics

  • Implements a statistics build configuration which gathers useful statistics for maintainers. No impact if not selected for build. Documentation to follow in separate PR
  • Improves implementation of certain collections and provides dedicated non-generic collections in some cases.
  • Adds configuration by function for the runtime, which is used for trace builds etc. No change to normal invocation API.
  • Unfortunately this seems like a lot of changes but they are mainly func signatures for new structs etc.
  • Go has slightly change the formatting requirements - best to keep up to date but some files are merely formatting changes. Git can ignore whitespace changes on diffs etc though
  • Comment improvements for both me and any future maintainers

Badly formed grammars will see some small improvements in memory usage and performance, though I doubt that this is a lot. I have been using the mysql contributed grammar as an example of the worst runtime case. But I also used release build flags rather than the default go ones:

 go build -ldflags="-s -w" -gcflags="-N -l -d inlfuncswithclosures,inlstaticinit" . 

@kaby76 - maybe you can change your build rig to use the go flags above. It can make a difference in some cases, especially on good grammars.

From here, I will concentrate on rewarding well formed grammars. I am disinclined to spend more time on the worst cases for the moment, until the statistics package that this PR implements is fully implemented.

@parrt - if you would please merge this when you have a chance?

@parrt parrt added this to the 4.12.1 milestone Apr 11, 2023
@parrt parrt merged commit dc0ae0e into antlr:dev Apr 11, 2023
@parrt
Copy link
Member

parrt commented Apr 11, 2023

yay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants