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

Improve FeatureParser performance #505

Merged
merged 1 commit into from
Jan 30, 2018

Conversation

tlecomte
Copy link

Improve FeatureParser performance by caching CultureAwareDialectProvider and LanguageServices.

Profiling shows that creating the CultureAwareDialectProvider and LanguageServices objects is quite costly.
FeatureParser is creating them repeatedly. In this commit, these objects are cached in dictionaries.

This has been tested on a solution with 6000 test scenarios, with the following options:
Pickles.exe -f xxx -o xxx --trfmt=nunit3 --enableComments=false -df=json -lr=xxx

Before: 4.3 seconds
After: 2.0 seconds

Unit tests pass.
The resulting json files are identical (except "GeneratedOn" datetime).

Improve FeatureParser performance by caching CultureAwareDialectProvider and LanguageServices.

Profiling shows that creating the CultureAwareDialectProvider and LanguageServices objects is quite costly.
FeatureParser is creating them repeatedly. In this commit, these objects are cached in dictionaries.

This has been tested on a solution with 6000 test scenarios, with the following options:
Pickles.exe -f xxx -o xxx --trfmt=nunit3 --enableComments=false -df=json -lr=xxx

Before: 4.3 seconds
After: 2.0 seconds

Unit tests pass.
The resulting json files are identical (except "GeneratedOn" datetime).
@tlecomte
Copy link
Author

So after this PR is merged (if it is merged), we went down from 15 seconds to 2 seconds for a 6000-scenarios solution. The remaining time is dominated by the Json serialization and the Gherkin parsing. There is room for improvement on the Json serialization side: it involves defining the structure before-hand instead of letting Json.net figure it out by reflection. I'm not sure it's worth it though.
Regarding the Gherkin parsing, I don't really know if there is room for improvement.

Thanks for considering this PR ! And thanks again for pickles 😄 !

@dirkrombauts dirkrombauts merged commit a64ce1a into picklesdoc:develop Jan 30, 2018
@dirkrombauts
Copy link
Member

dirkrombauts commented Jan 30, 2018

Thanks again! I hope to be able to release a new version on thursday evening (central european time)

@dirkrombauts
Copy link
Member

Released in version 2.18.0

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.

2 participants