Skip to content

Conversation

@judofyr
Copy link
Contributor

@judofyr judofyr commented Nov 27, 2025

Description

This adds a "pauser" into the descriptor converter which avoids blocking the UI by scheduling idle callbacks. See the comment in the code for justification and potential follow-up work.

What to review

This PR.

Testing

N/A.

Notes for release

N/A. Internal only at the moment.

@vercel
Copy link

vercel bot commented Nov 27, 2025

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

Project Deployment Preview Comments Updated (UTC)
page-building-studio Ready Ready Preview Comment Nov 28, 2025 1:10pm
test-studio Ready Ready Preview Comment Nov 28, 2025 1:10pm
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
e2e-studio Ignored Ignored Nov 28, 2025 1:10pm
studio-workshop Ignored Ignored Preview Nov 28, 2025 1:10pm
test-next-studio Ignored Ignored Nov 28, 2025 1:10pm

Copy link
Contributor Author

judofyr commented Nov 27, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

🧪 E2E Preview environment

🔑 Environment Variables for Local Testing

This is the preview URL for the E2E tests: https://e2e-studio-iuwlos0ff.sanity.dev

To run the E2E tests locally, you can use the following environment variables, then run pnpm test:e2e --ui to open the Playwright test runner.

💬 Remember to build the project first with pnpm build:e2e.

  SANITY_E2E_PROJECT_ID=ittbm412
  SANITY_E2E_BASE_URL=https://e2e-studio-iuwlos0ff.sanity.dev
  SANITY_E2E_DATASET="update depending the project you want to test (pr-11310-chromium-19764655675 || pr-11310-firefox-19764655675 )"
  SANITY_E2E_DATASET_CHROMIUM=pr-11310-chromium-19764655675
  SANITY_E2E_DATASET_FIREFOX=pr-11310-firefox-19764655675

@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

📊 Playwright Test Report

Download Full E2E Report

This report contains test results, including videos of failing tests.

@judofyr judofyr self-assigned this Nov 27, 2025
@judofyr judofyr marked this pull request as ready for review November 27, 2025 14:21
@judofyr judofyr requested a review from a team as a code owner November 27, 2025 14:21
@judofyr judofyr requested review from dcilke and pedrobonamin and removed request for a team November 27, 2025 14:21
@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

⚡️ Editor Performance Report

Updated Fri, 28 Nov 2025 13:22:49 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 28.6 efps (35ms) 27.0 efps (37ms) +2ms (+5.7%)
article (body) 38.8 efps (26ms) 37.2 efps (27ms) +1ms (+4.3%)
article (string inside object) 29.9 efps (34ms) 28.2 efps (36ms) +2ms (+6.0%)
article (string inside array) 24.4 efps (41ms) 24.4 efps (41ms) +0ms (-/-%)
recipe (name) 52.6 efps (19ms) 50.0 efps (20ms) +1ms (+5.3%)
recipe (description) 64.5 efps (16ms) 69.0 efps (15ms) -1ms (-/-%)
recipe (instructions) 99.9+ efps (7ms) 99.9+ efps (7ms) -0ms (-/-%)
singleString (stringField) 71.4 efps (14ms) 66.7 efps (15ms) +1ms (-/-%)
synthetic (title) 17.2 efps (58ms) 18.2 efps (55ms) -3ms (-5.2%)
synthetic (string inside object) 17.2 efps (58ms) 17.9 efps (56ms) -2ms (-3.4%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 35ms 38ms 41ms 98ms 26ms 9.9s
article (body) 26ms 31ms 67ms 239ms 281ms 6.3s
article (string inside object) 34ms 38ms 40ms 130ms 41ms 6.0s
article (string inside array) 41ms 45ms 50ms 138ms 40ms 6.2s
recipe (name) 19ms 21ms 24ms 44ms 0ms 7.7s
recipe (description) 16ms 18ms 24ms 36ms 0ms 4.1s
recipe (instructions) 7ms 10ms 12ms 57ms 11ms 3.1s
singleString (stringField) 14ms 16ms 20ms 37ms 0ms 6.0s
synthetic (title) 58ms 62ms 65ms 175ms 375ms 14.8s
synthetic (string inside object) 58ms 61ms 82ms 159ms 309ms 7.5s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 37ms 41ms 71ms 128ms 52ms 10.2s
article (body) 27ms 31ms 82ms 198ms 192ms 6.2s
article (string inside object) 36ms 40ms 44ms 175ms 106ms 5.8s
article (string inside array) 41ms 44ms 69ms 124ms 57ms 6.3s
recipe (name) 20ms 22ms 23ms 50ms 1ms 7.5s
recipe (description) 15ms 18ms 24ms 52ms 0ms 4.2s
recipe (instructions) 7ms 10ms 11ms 15ms 0ms 3.1s
singleString (stringField) 15ms 17ms 20ms 39ms 0ms 6.6s
synthetic (title) 55ms 57ms 66ms 163ms 267ms 15.9s
synthetic (string inside object) 56ms 57ms 59ms 134ms 189ms 7.2s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 27, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 44.75% 63947 / 142892
🔵 Statements 44.75% 63947 / 142892
🔵 Functions 48.37% 3416 / 7061
🔵 Branches 79.42% 13036 / 16414
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/@sanity/schema/src/descriptors/convert.ts 93.45% 88.81% 96.29% 93.45% 105, 423-424, 516-517, 525-533, 553-554, 567-574, 630-631, 645-646, 664, 674, 684, 692, 704, 718, 726, 736, 742, 744, 770-771
packages/@sanity/schema/src/descriptors/scheduler.ts 21.73% 80% 75% 21.73% 16-84
packages/sanity/src/core/config/uploadSchema.ts 38.96% 41.66% 100% 38.96% 21-22, 76-81, 87-135
Generated in workflow #46668 for commit 24cc74c by the Vitest Coverage Report Action

This adds a "pauser" into the descriptor converter which avoids blocking
the UI by scheduling idle callbacks. See the comment in the code for
justification and potential follow-up work.
@judofyr judofyr force-pushed the cldx-4355/async-descriptor-converter branch from 63e37aa to e8af851 Compare November 28, 2025 13:04
@judofyr judofyr force-pushed the cldx-4355/avoid-blocking-ui branch from 457a4a7 to 24cc74c Compare November 28, 2025 13:04
@judofyr judofyr requested a review from dcilke November 28, 2025 13:05
@judofyr
Copy link
Contributor Author

judofyr commented Nov 28, 2025

I've now slightly tweaked it:

  • Adding a "scheduler" interface so that outside of the browser (i.e. sanity schema validate) we don't unnecessarily use idle callbacks.
  • Add more higher level methods for "doing work" instead of "pausing".
  • Avoid pausing when it's been too short since the last pause.
  • Fixed a bug with the duration recording.

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.

3 participants