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

Test: Remove repeated JSON.stringifys in assertSetValidity #10627

Merged

Conversation

larry-the-table-guy
Copy link
Contributor

While working on #10616 , I've observed that several seconds are spent building strings in assertSetValidity from ./test/random-battles/tools.js.

Stats:
249K calls

stage time (ms)
Baseline 6858
Pull out JSON.stringify 3673
Replace all strings with '' 2770

So, you can save up to another 1s by lazily constructing the strings. I decided to pass on that.

3 seconds doesn't seem like a lot right now, but with my local copy of #10616, I'm at ~135 seconds total. So, it adds up. And it's an easy change.

I could not produce similar gains for the other functions in that file, so I left them alone.

@KrisXV KrisXV merged commit c98a53b into smogon:master Oct 23, 2024
1 check passed
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