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

Use mutative instead of immer #243

Merged
merged 1 commit into from
Sep 19, 2024
Merged

Use mutative instead of immer #243

merged 1 commit into from
Sep 19, 2024

Conversation

stopachka
Copy link
Contributor

@stopachka stopachka commented Sep 19, 2024

Immer autofreezes objects. When the object is really large, this gets more and more costly. I switched us to mutative, which does not rely on auto-freeze. They have a comparison about immer vs mutative here.

I made a bunch of transactions in our perf tester.

Before
many_tx_immer.json

A single transaction ontop of the bench query on immer is about 8ms. As you add more pending transactions, it grows to about 40ms.
image

After
many_tx_mutative.json

Mutative is about 3ms on a single transaction. As I add more pending transactions, the size seems to stay at 3ms!

CleanShot 2024-09-19 at 12 10 26@2x

@dwwoelfel @markyfyi @nezaj

Copy link

View Vercel preview at instant-www-js-perf3-jsv.vercel.app.

Copy link
Contributor

@dwwoelfel dwwoelfel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@stopachka stopachka merged commit 1016802 into main Sep 19, 2024
20 checks passed
@stopachka stopachka deleted the perf3 branch September 19, 2024 19:37
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