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

benchmark: add webstorage benchmark #55040

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakecastelli
Copy link
Contributor

@jakecastelli jakecastelli commented Sep 21, 2024

This PR adds benchmarks to web storage feature.

There are 3 main categories covered by this PR:

Set item

Storage Type Method Performance (n=100000)
localStorage setItem 32,226.011329779365
localStorage property setter 31,983.078822509164
sessionStorage setItem 99,525.92487767464
sessionStorage property setter 96,256.61628876119

Get item

Storage Type Method Performance (n=100000)
localStorage getItem 339,745.7512670393
localStorage property getter 318,879.11897832097
sessionStorage getItem 546,089.0025795224
sessionStorage property getter 605,112.5963263614

Remove item

Storage Type Method Performance (n=100000)
localStorage removeItem 43,976.48979563462
localStorage delete property 41,734.89234719278
sessionStorage removeItem 228,343.04220928214
sessionStorage delete property 507,564.5105229822

Some quick observations:

  • The sessionStorage is faster than localStorage in general
  • Delete property seems faster than removeItem in sessionStorage

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/performance

@nodejs-github-bot nodejs-github-bot added the benchmark Issues and PRs related to the benchmark subsystem. label Sep 21, 2024
@jasnell jasnell added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 21, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 21, 2024
@nodejs-github-bot
Copy link
Collaborator

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

RSLGTM

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Issues and PRs related to the benchmark subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants