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: write balance to local storage on beforeunload #13

Merged
merged 1 commit into from
Jun 30, 2024

Conversation

AnsonH
Copy link
Owner

@AnsonH AnsonH commented Jun 30, 2024

Description

Ditches the use of svelte-persisted-store for the balance state, so that we writes the wallet balance value to local storage only on Window's beforeunload event instead of writing on every value change.

Motivation

While I'm trying to debug performance issues, I noticed that every dropBall call has an updateStorage call to update the local storage. While this occupies a small amount of time, my computer has a fast SSD so writing to disk is fast. The same cannot be said for low-end devices where I/O time is slow.

image

@AnsonH AnsonH added the perf Performance label Jun 30, 2024
@AnsonH AnsonH self-assigned this Jun 30, 2024
Copy link

@AnsonH AnsonH merged commit c3e6f8b into main Jun 30, 2024
2 checks passed
@AnsonH AnsonH deleted the perf/local-storage branch June 30, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf Performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant