-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
More efficient implementation when conditionally stripping typename from variables #10890
Conversation
|
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad this idea ended up being worth pursuing! Thanks for following up on it @jerelmiller.
Co-authored-by: Ben Newman <[email protected]>
d67cc66
to
785f68d
Compare
#10853 introduced the ability to remove
__typename
from variables with an option to keep__typename
at specific variable paths.There was a question of whether we might be able to provide a more efficient way of handling this logic that would avoid the temporary array creation.
This PR introduces an alternate implementation that avoids some of the performance pitfalls of the initial implementation.
After running some benchmarks with a large data set (~2MB), this new implementation is about twice as fast as the old. Running this logic 5000 times with the old implementation took about 50s while the new implementation takes about 26s.
This PR also includes some additional tests for the
removeTypenameFromVariables
link that ensures it works with variables that do not include__typename
.Checklist: