Skip to content

demo(benchmark-react): Use response-size-based network simulation delays#3810

Merged
ntucker merged 1 commit intomasterfrom
network-sim-formula
Mar 22, 2026
Merged

demo(benchmark-react): Use response-size-based network simulation delays#3810
ntucker merged 1 commit intomasterfrom
network-sim-formula

Conversation

@ntucker
Copy link
Collaborator

@ntucker ntucker commented Mar 22, 2026

Motivation

The previous network simulation used fixed per-method delays (e.g. fetchIssueList 80ms, updateIssue 50ms), which didn't reflect how real network latency scales with payload size. A 10,000-item list response had the same delay as a 100-item list, understating the cost of large refetches.

Solution

Replace NETWORK_SIM_DELAYS (fixed per-method map) with a formula-based NETWORK_SIM_CONFIG:

delay = 40ms base latency + ceil(recordCount / 20) ms

The worker's respond() function now computes delay dynamically from the actual response data — Array.isArray(value) ? value.length : 1 for the record count. This means:

Records Delay
1 (entity detail/mutation) 41ms
100 45ms
500 65ms
1,000 90ms
10,000 540ms

Libraries that must refetch large lists after mutations are penalized proportionally to the data volume, while normalized propagation (data-client) bypasses refetching entirely.

Updated README results table with fresh measurements under the new delay model. Also increased pre-mount timeout from 10s to 60s when network sim is enabled, since large list fetches can now exceed 10s.

Open questions

N/A

@changeset-bot
Copy link

changeset-bot bot commented Mar 22, 2026

⚠️ No Changeset found

Latest commit: 3b3eac1

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

@vercel
Copy link

vercel bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs-site Ignored Ignored Preview Mar 22, 2026 0:16am

@codecov
Copy link

codecov bot commented Mar 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.06%. Comparing base (ee441c6) to head (3b3eac1).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3810   +/-   ##
=======================================
  Coverage   98.06%   98.06%           
=======================================
  Files         151      151           
  Lines        2843     2843           
  Branches      556      556           
=======================================
  Hits         2788     2788           
  Misses         11       11           
  Partials       44       44           

☔ 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.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Benchmark React

Details
Benchmark suite Current: 3b3eac1 Previous: ee441c6 Ratio
data-client: getlist-100 62.11 ops/s (± 0.49) 57.14 ops/s (± 0.21) 0.92
data-client: getlist-500 27.17 ops/s (± 1.99) 26.25 ops/s (± 0.43) 0.97
data-client: update-entity 217.39 ops/s (± 15.07) 217.39 ops/s (± 2.62) 1
data-client: update-user 185.19 ops/s (± 20.6) 156.25 ops/s (± 12.54) 0.84
data-client: getlist-500-sorted 23.04 ops/s (± 1.56) 22.68 ops/s (± 1.77) 0.98
data-client: update-entity-sorted 192.31 ops/s (± 22.09) 188.68 ops/s (± 17.31) 0.98
data-client: update-entity-multi-view 243.9 ops/s (± 6.74) 238.1 ops/s (± 36.8) 0.98
data-client: list-detail-switch-10 8.1 ops/s (± 0.05) 6.35 ops/s (± 1.18) 0.78
data-client: update-user-10000 21.28 ops/s (± 1.06) 20.62 ops/s (± 0.23) 0.97
data-client: invalidate-and-resolve 34.13 ops/s (± 1.04) 31.85 ops/s (± 1.01) 0.93
data-client: unshift-item 175.44 ops/s (± 19.77) 169.49 ops/s (± 19.46) 0.97
data-client: delete-item 172.41 ops/s (± 5.54) 158.73 ops/s (± 1.67) 0.92
data-client: move-item 163.93 ops/s (± 3.78) 149.25 ops/s (± 8.97) 0.91

This comment was automatically generated by workflow using github-action-benchmark.

Replace fixed per-method network delays with a formula: 40ms base latency +
2ms per record in the response. This more realistically models how network
time scales with payload size, naturally penalizing large list refetches
relative to normalized cache propagation.

Made-with: Cursor
@ntucker ntucker force-pushed the network-sim-formula branch from b5b9bb1 to 3b3eac1 Compare March 22, 2026 12:16
@ntucker ntucker merged commit 2c98dde into master Mar 22, 2026
21 checks passed
@ntucker ntucker deleted the network-sim-formula branch March 22, 2026 12:27
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.

1 participant