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

Memoize atom so that a STRING+ node only gets parsed once #67

Merged
merged 3 commits into from
Apr 14, 2020

Conversation

lysnikolaou
Copy link
Member

I think it makes sense to memoize atom, but if we don't want to do so, we can extract STRING+ into a new rule and memoize that.

Closes #64.

@gvanrossum
Copy link

We should really have a script that automatically reproduces the benchmarks I posted to the PEP, so we can compare the effect of a proposed change.

@lysnikolaou
Copy link
Member Author

lysnikolaou commented Apr 11, 2020

We should really have a script that automatically reproduces the benchmarks I posted to the PEP, so we can compare the effect of a proposed change.

I could quickly write up a script that does that, but the workflow you used to get those stats is not clear to me.

@gvanrossum
Copy link

I could quickly write up a script that does that, but the workflow you used to get those stats is not clear to me.

I timed things in the old "pegen" repo.

  • The numbers for the canonical test file were done using the "make time_compile" and "make time_stdlib_compile" targets, running each three times and taking the middle outcome.

  • The numbers for compiling the stdlib were done using the "make bench" command. This runs "make simpy_cpython" three times, I just used the middle outcome. Note that it will print memory stats if you pip install psutil. In order to get numbers for compilation to bytecode I changed the test_parse_directory.py script to set mode=2. I then did another run with the parse.parse_file() call replaced by compile(open(file).read(), file, "exec") (IIRC) to get numbers for the old compiler with the same input set.

I would rerun things in the Tools/peg_generator subtree here, but currently the "make build" target fails for me there.

Copy link

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

Yeah!

@gvanrossum gvanrossum merged commit b684233 into pegen Apr 14, 2020
@gvanrossum gvanrossum deleted the memo-atom branch April 14, 2020 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure in test_string_literals: Unexpected amount of warnings
2 participants