-
Notifications
You must be signed in to change notification settings - Fork 30
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
Memory usage compared to gcc compiler #62
Comments
And for comparison with https://github.com/edubart/lpegrex/blob/main/parsers/c11.lua that outputs an
|
And here is the same using https://github.com/soasme/PeppaPEG with a slightly modified grammar (attached),
|
I did some measurements on how/when the memory is allocated (see attached) and here a sample of the summaries: Header (FULL)
Header (FIRST 50 lines)
|
And
|
It is not very fair to compare the result of generic, multi-purpose packrat parser-generator to hand-written, single-purpose parser, that is optimized by some of the worlds best developers over last 35 years... I don't see any issue here, packcc never claimed to be memory efficient. The main goal is to be easy to work with and generate easily understandable code. |
Thanks for your interesting report. By the way,
should be
|
Thank you for pointing out my mistake, here is again the output for the peg from Piumarta:
|
And here is the attached files used to produce the output shown above: I'm making some changes to peg/leg here https://github.com/mingodad/peg |
Also |
That makes sense. Left-recursive grammars can be detected before generating parsers. |
And here is the test with https://github.com/yhirose/cpp-peglib tool
|
Hello @mingodad I have stumbled into this issue after a long time and realized that you might be having same problem as I had some time ago. I was using packcc to generate Kotlin parser, but it was slow and took a lot of memory. This have led me to start working on pegof , which can optimize the grammar before it is compiled. I have just tried with the grammar from your original post and here is the result:
You'll be probably most interested in the last two columns. Duration here is how long it took to process I'm not sure if you're still interested in this after two years (sorry for disturbing you if that is the case), but it might be useful to you in some future project or to anyone who finds this issue when looking for solution to some similar problem. |
Thank you ! |
Looking for a ready to use
C
peg grammar I found this one https://github.com/pointlander/peg/blob/master/grammars/c/c.peg and needed to make some changes (see attached) to build and parse the generatedC
file usingpackcc
then I did a comparison of time and memory usage againstgcc
compiling it and got the result shown bellow, the generated parser compiled with-O2
uses 12x more memory thangcc
compiling without optimization and 6.6x more when compiling with-O2
.c99-mouse.peg.zip
The text was updated successfully, but these errors were encountered: