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

[perf/stringify]: Use a Map for prevObjects in createNode #137

Merged
merged 1 commit into from
Mar 5, 2020

Conversation

MikeRalphson
Copy link
Contributor

Using the Array.find method for prevObjects seems to be a serious bottleneck in the stringify method (src/schema/index createNode method).

On a 14Mb YAML file, with this change, time to run stringify dropped from around 4 minutes to 4 seconds on my machine.

I get the same test results before and after.

@MikeRalphson MikeRalphson requested a review from eemeli February 16, 2020 18:47
@eemeli eemeli merged commit a1996d8 into eemeli:master Mar 5, 2020
@eemeli
Copy link
Owner

eemeli commented Mar 5, 2020

Thank you, this is excellent! And apologies for taking so long to get to this, I was bogged down by other stuff and wanted to make sure that this would not cause any problems in browsers. But as it turns out, I'd forgotten that even IE 11 supports Map, so that's a non-issue.

I'll put together a new minor release shortly.

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