Skip to content

chore: Add benchmarks for i18n vs vanilla usage#2372

Open
aklinker1 wants to merge 1 commit into
mainfrom
i18n-benchmarks
Open

chore: Add benchmarks for i18n vs vanilla usage#2372
aklinker1 wants to merge 1 commit into
mainfrom
i18n-benchmarks

Conversation

@aklinker1
Copy link
Copy Markdown
Member

@aklinker1 aklinker1 commented May 12, 2026

Overview

We wanted to use benchmarks to evaulate #2332, but they don't exist. So I've written benchmarks for the current state of the package, here are the results:

Simple
┌───┬───────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼───────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ Vanilla   │ 6302.2 ± 6.26%   │ 0.00 ± 0.00      │ 150554 ± 0.11%         │ 158674 ± 0             │ 158674  │
│ 1 │ WXT I18n  │ 5306.0 ± 3.90%   │ 0.00 ± 0.00      │ 180540 ± 0.09%         │ 188466 ± 0             │ 188466  │
└───┴───────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘

Substitution
┌───┬───────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼───────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ Vanilla   │ 8300.8 ± 5.09%   │ 0.00 ± 0.00      │ 113798 ± 0.13%         │ 120471 ± 0             │ 120543  │
│ 1 │ WXT I18n  │ 13988 ± 4.77%    │ 0.00 ± 0.00      │ 65134 ± 0.21%          │ 71488 ± 0              │ 71488   │
└───┴───────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘

Plural (singular form)
┌───┬───────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼───────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ Vanilla   │ 10164 ± 5.07%    │ 0.00 ± 0.00      │ 91648 ± 0.16%          │ 98384 ± 0              │ 98394   │
│ 1 │ WXT I18n  │ 15210 ± 5.01%    │ 0.00 ± 0.00      │ 59393 ± 0.23%          │ 65745 ± 0              │ 65745   │
└───┴───────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘

Plural (plural form)
┌───┬───────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼───────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ Vanilla   │ 10822 ± 5.03%    │ 0.00 ± 0.00      │ 85731 ± 0.17%          │ 92406 ± 0              │ 92415   │
│ 1 │ WXT I18n  │ 15242 ± 6.28%    │ 0.00 ± 0.00      │ 59450 ± 0.23%          │ 65607 ± 0              │ 65640   │
└───┴───────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘

Looking at ops/sec, for simple keys, no substitutions, it's about even. But for substitutions/plural, WXT is ~0.6-0.7 times slower than vanilla.

Manual Testing

bun --cwd packages/i18n bench

And follow the instructions.

Related Issue

@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 2a2d105
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6a03948bebfb89000899644d
😎 Deploy Preview https://deploy-preview-2372--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the pkg/i18n Includes changes to the `packages/i18n` directory label May 12, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 12, 2026

Open in StackBlitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@2372

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@2372

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@2372

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@2372

@wxt-dev/is-background

npm i https://pkg.pr.new/@wxt-dev/is-background@2372

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@2372

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@2372

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@2372

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@2372

@wxt-dev/runner

npm i https://pkg.pr.new/@wxt-dev/runner@2372

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@2372

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@2372

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@2372

wxt

npm i https://pkg.pr.new/wxt@2372

commit: 2a2d105

@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.43%. Comparing base (9ee07f4) to head (2a2d105).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2372      +/-   ##
==========================================
- Coverage   78.69%   78.43%   -0.26%     
==========================================
  Files         133      133              
  Lines        3882     3882              
  Branches      875      875              
==========================================
- Hits         3055     3045      -10     
- Misses        741      750       +9     
- Partials       86       87       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/i18n Includes changes to the `packages/i18n` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant