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: only call createHTMLDocument when it is needed #1294

Closed
wants to merge 1 commit into from

Conversation

mdellanoce
Copy link
Contributor

@mdellanoce mdellanoce commented Aug 30, 2023

I noticed on a very large mutation that createHTMLDocument was a significant portion of the processing time. It appears that unnattachedDoc is only used in one specific branch, so rather than create it every time processMutation is called, I moved it so that it is only created in the branch where it is used.

This improves a couple of the benchmarks, while the others appear to be unaffected either way:

Before:
image
image

After:
image
image

@changeset-bot
Copy link

changeset-bot bot commented Aug 30, 2023

⚠️ No Changeset found

Latest commit: bb44001

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kwalker3690
Copy link

@YunFeng0817 @Juice10 can this PR be approved/merged? We just ran into this performance improvement as well and would really like to incorporate it into our use case

@eoghanmurray
Copy link
Contributor

I'm gonna do a slight refactor so that the document is shared once created

@eoghanmurray
Copy link
Contributor

Here is my suggested change:
eoghanmurray@1ad42a7
(I don't know how to push that as a new commit on top of this PR)

@mdellanoce
Copy link
Contributor Author

@eoghanmurray just close this and open a new PR, i guess

@mdellanoce
Copy link
Contributor Author

closing due to duplication with #1321

@mdellanoce mdellanoce closed this Nov 3, 2023
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.

3 participants