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

rewrite followSets() to drastically improve compile performance #408

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cosmicexplorer
Copy link

Problem

I am looking to introduce some changes to the CoffeeScript Jison grammar. In doing so, I found that it took surprisingly long to generate. I added some grammar compile performance measurements to the CoffeeScript build system in jashkenas/coffeescript#5473, and was wondering if there was a way to improve them.

Solution

I spent quite a while rewriting a lot of the code (see e.g. https://github.com/zaach/jison/compare/master...cosmicexplorer:jison:performance-work-for-coffeescript?expand=1), and while I think a lot of that would be useful to the project, I found that the performance could be vastly improved by modifying a single method: followSets(), which performs a fixed-point calculation.

Result

There should be no change in functionality or compatibility, but many compiles should run much faster. The CoffeeScript parser build time goes from ~12 seconds down to ~4 seconds on my laptop with this change (3x improvement).

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.

1 participant