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

avoid object-spread in perf-critical code, use Object.assign-instead #164892

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

jrieken
Copy link
Member

@jrieken jrieken commented Oct 28, 2022

Random find from profiling. Looks like object spread is much slower than Object.assign1 . Using assign instead of spread in the registerConfigurationSchemas function reduces its total selftime (sum of all invocation) from ~120ms to ~30ms 🐎

before

Screenshot 2022-10-28 at 17 28 25

after

Screenshot 2022-10-28 at 17 28 50

1On Safari both are equal but on chrome the difference is significant: https://www.measurethat.net/Benchmarks/Show/2978/0/lodash-merge-vs-objectassign-vs-spread

@jrieken jrieken self-assigned this Oct 28, 2022
@jrieken jrieken enabled auto-merge (squash) October 28, 2022 15:24
@jrieken jrieken requested a review from sandy081 October 28, 2022 15:24
@VSCodeTriageBot VSCodeTriageBot added this to the November 2022 milestone Oct 28, 2022
@jrieken jrieken merged commit cedf7a2 into main Oct 28, 2022
@jrieken jrieken deleted the joh/zygomorphic-roadrunner branch October 28, 2022 16:43
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants