-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
Parser optimizations #537
Parser optimizations #537
Conversation
Thank you very much 🙏 I totally missed that |
Also with the previous benchmark: require "./src/all"
require "benchmark"
filename = "./core/source/Provider/ElementSize.mint"
source = File.read(filename)
Benchmark.ips do |x|
x.report("parse") do
Mint::Parser.parse(source, filename)
end
end Before:
After:
So it's about twice as fast and consumes half the memory in the general case. And for this particular I still have to investigate why it takes 20MB to parse that file, so there's still room for optimization! But it can be done in a separate PR. |
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
…parser-optimizations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀 (missing spec for next_whitespace_index
would be a nice to have, but not required)
Thank you very much! 🙏 🎉 |
Hi!
See discussion starting at #536 (comment)
This is just a draft... I think the style or final code can be further improved, but at least the optimization ideas should be clear from the commits.
This is the benchmark I used:
The file "icons.mint" comes from here: https://github.com/mint-lang/mint-tabler-icons/blob/as-functions/source/Icons.mint
Before this PR:
With this PR: