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

Implement faster Rope equality #3955

Merged
merged 4 commits into from
Feb 28, 2023
Merged

Implement faster Rope equality #3955

merged 4 commits into from
Feb 28, 2023

Conversation

jridgewell
Copy link
Contributor

This optimizes for more reference equality checks. The old code allowed for this to happen for Local(Bytes) checks, but it didn't implement reference checks for Shared(InnerRope) shared data. Instead, it'd iterate every RopeElem inside the shared rope and perform equality on those.

This optimizes for more reference equality checks. The old code allowed for this to happen for `Local(Bytes)` checks, but it didn't implement reference checks for `Shared(InnerRope)` shared data. Instead, it'd iterate every `RopeElem` inside the shared rope and perform quality on those.
@vercel
Copy link

vercel bot commented Feb 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
examples-cra-web 🔄 Building (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)
examples-svelte-web 🔄 Building (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)
8 Ignored Deployments
Name Status Preview Comments Updated
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)
examples-nonmonorepo ⬜️ Ignored (Inspect) Feb 28, 2023 at 2:10AM (UTC)
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)
turbo-site ⬜️ Ignored (Inspect) Visit Preview Feb 28, 2023 at 2:10AM (UTC)

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2023

🟢 CI successful 🟢

Thanks

@github-actions
Copy link
Contributor

Benchmark for dcd962c

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 11.14ms ± 0.06ms 8964.67µs ± 58.39µs -19.52% -17.51%
bench_hmr_to_commit/Turbopack RCC/1000 modules 15.62ms ± 0.32ms 13.18ms ± 0.15ms -15.61% -9.96%
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.00ms ± 0.08ms 9059.78µs ± 39.55µs -17.62% -15.64%
bench_hmr_to_eval/Turbopack CSR/1000 modules 9895.36µs ± 77.11µs 7878.10µs ± 29.44µs -20.39% -18.52%
bench_hmr_to_eval/Turbopack SSR/1000 modules 10.08ms ± 0.10ms 8050.54µs ± 40.53µs -20.15% -17.74%
bench_startup/Turbopack SSR/1000 modules 2033.74ms ± 4.75ms 2050.62ms ± 2.41ms +0.83% +0.12%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 11.14ms ± 0.06ms 8964.67µs ± 58.39µs -19.52% -17.51%
bench_hmr_to_commit/Turbopack RCC/1000 modules 15.62ms ± 0.32ms 13.18ms ± 0.15ms -15.61% -9.96%
bench_hmr_to_commit/Turbopack RSC/1000 modules 498.66ms ± 1.26ms 495.12ms ± 1.79ms -0.71%
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.00ms ± 0.08ms 9059.78µs ± 39.55µs -17.62% -15.64%
bench_hmr_to_eval/Turbopack CSR/1000 modules 9895.36µs ± 77.11µs 7878.10µs ± 29.44µs -20.39% -18.52%
bench_hmr_to_eval/Turbopack RCC/1000 modules 14.99ms ± 0.66ms 12.71ms ± 0.95ms -15.22%
bench_hmr_to_eval/Turbopack SSR/1000 modules 10.08ms ± 0.10ms 8050.54µs ± 40.53µs -20.15% -17.74%
bench_hydration/Turbopack RCC/1000 modules 3764.81ms ± 13.61ms 3769.64ms ± 11.40ms +0.13%
bench_hydration/Turbopack RSC/1000 modules 3445.30ms ± 11.86ms 3412.48ms ± 9.44ms -0.95%
bench_hydration/Turbopack SSR/1000 modules 3295.25ms ± 9.34ms 3285.06ms ± 11.43ms -0.31%
bench_startup/Turbopack CSR/1000 modules 2526.25ms ± 4.64ms 2519.13ms ± 8.21ms -0.28%
bench_startup/Turbopack RCC/1000 modules 2305.22ms ± 5.20ms 2329.18ms ± 8.75ms +1.04%
bench_startup/Turbopack RSC/1000 modules 2277.72ms ± 6.20ms 2255.82ms ± 8.12ms -0.96%
bench_startup/Turbopack SSR/1000 modules 2033.74ms ± 4.75ms 2050.62ms ± 2.41ms +0.83% +0.12%

@github-actions
Copy link
Contributor

Benchmark for 53ad6e0

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 11.58ms ± 0.07ms 9333.24µs ± 50.57µs -19.44% -17.56%
bench_hmr_to_commit/Turbopack RCC/1000 modules 15.19ms ± 0.17ms 12.70ms ± 0.16ms -16.37% -12.35%
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.57ms ± 0.09ms 9294.87µs ± 62.01µs -19.63% -17.33%
bench_hmr_to_eval/Turbopack CSR/1000 modules 10.68ms ± 0.09ms 8362.03µs ± 26.23µs -21.69% -19.89%
bench_hmr_to_eval/Turbopack RCC/1000 modules 13.87ms ± 0.28ms 10.59ms ± 0.10ms -23.65% -18.93%
bench_hmr_to_eval/Turbopack SSR/1000 modules 10.64ms ± 0.09ms 8412.31µs ± 41.42µs -20.97% -18.86%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 11.58ms ± 0.07ms 9333.24µs ± 50.57µs -19.44% -17.56%
bench_hmr_to_commit/Turbopack RCC/1000 modules 15.19ms ± 0.17ms 12.70ms ± 0.16ms -16.37% -12.35%
bench_hmr_to_commit/Turbopack RSC/1000 modules 512.62ms ± 2.24ms 505.40ms ± 1.56ms -1.41%
bench_hmr_to_commit/Turbopack SSR/1000 modules 11.57ms ± 0.09ms 9294.87µs ± 62.01µs -19.63% -17.33%
bench_hmr_to_eval/Turbopack CSR/1000 modules 10.68ms ± 0.09ms 8362.03µs ± 26.23µs -21.69% -19.89%
bench_hmr_to_eval/Turbopack RCC/1000 modules 13.87ms ± 0.28ms 10.59ms ± 0.10ms -23.65% -18.93%
bench_hmr_to_eval/Turbopack SSR/1000 modules 10.64ms ± 0.09ms 8412.31µs ± 41.42µs -20.97% -18.86%
bench_hydration/Turbopack RCC/1000 modules 3879.64ms ± 14.22ms 3869.35ms ± 14.45ms -0.27%
bench_hydration/Turbopack RSC/1000 modules 3509.01ms ± 13.30ms 3522.93ms ± 10.52ms +0.40%
bench_hydration/Turbopack SSR/1000 modules 3383.73ms ± 12.47ms 3361.50ms ± 10.23ms -0.66%
bench_startup/Turbopack CSR/1000 modules 2595.50ms ± 6.71ms 2587.19ms ± 11.06ms -0.32%
bench_startup/Turbopack RCC/1000 modules 2377.08ms ± 10.06ms 2373.90ms ± 10.57ms -0.13%
bench_startup/Turbopack RSC/1000 modules 2328.08ms ± 10.27ms 2338.51ms ± 12.62ms +0.45%
bench_startup/Turbopack SSR/1000 modules 2079.67ms ± 3.45ms 2077.27ms ± 2.48ms -0.12%

@jridgewell jridgewell added the pr: automerge Kodiak will merge these automatically after checks pass label Feb 28, 2023
@github-actions
Copy link
Contributor

Benchmark for ee27be7

Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 12.56ms ± 0.12ms 10.09ms ± 0.07ms -19.63% -16.88%
bench_hmr_to_commit/Turbopack RCC/1000 modules 16.22ms ± 0.23ms 12.82ms ± 0.29ms -20.93% -14.95%
bench_hmr_to_commit/Turbopack SSR/1000 modules 12.49ms ± 0.10ms 10.04ms ± 0.03ms -19.60% -17.72%
bench_hmr_to_eval/Turbopack CSR/1000 modules 11.52ms ± 0.14ms 8976.27µs ± 50.88µs -22.07% -19.20%
bench_hmr_to_eval/Turbopack RCC/1000 modules 14.43ms ± 0.28ms 11.32ms ± 0.15ms -21.55% -16.16%
bench_hmr_to_eval/Turbopack SSR/1000 modules 11.39ms ± 0.12ms 9002.98µs ± 49.15µs -20.99% -18.48%
bench_hydration/Turbopack RSC/1000 modules 3626.73ms ± 17.12ms 3565.20ms ± 10.31ms -1.70% -0.19%
Click to view full benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 12.56ms ± 0.12ms 10.09ms ± 0.07ms -19.63% -16.88%
bench_hmr_to_commit/Turbopack RCC/1000 modules 16.22ms ± 0.23ms 12.82ms ± 0.29ms -20.93% -14.95%
bench_hmr_to_commit/Turbopack RSC/1000 modules 516.48ms ± 1.08ms 514.34ms ± 1.76ms -0.41%
bench_hmr_to_commit/Turbopack SSR/1000 modules 12.49ms ± 0.10ms 10.04ms ± 0.03ms -19.60% -17.72%
bench_hmr_to_eval/Turbopack CSR/1000 modules 11.52ms ± 0.14ms 8976.27µs ± 50.88µs -22.07% -19.20%
bench_hmr_to_eval/Turbopack RCC/1000 modules 14.43ms ± 0.28ms 11.32ms ± 0.15ms -21.55% -16.16%
bench_hmr_to_eval/Turbopack SSR/1000 modules 11.39ms ± 0.12ms 9002.98µs ± 49.15µs -20.99% -18.48%
bench_hydration/Turbopack RCC/1000 modules 3929.86ms ± 8.88ms 3931.83ms ± 12.72ms +0.05%
bench_hydration/Turbopack RSC/1000 modules 3626.73ms ± 17.12ms 3565.20ms ± 10.31ms -1.70% -0.19%
bench_hydration/Turbopack SSR/1000 modules 3446.68ms ± 10.64ms 3433.36ms ± 10.50ms -0.39%
bench_startup/Turbopack CSR/1000 modules 2627.92ms ± 6.52ms 2615.27ms ± 8.16ms -0.48%
bench_startup/Turbopack RCC/1000 modules 2401.63ms ± 7.92ms 2404.92ms ± 6.52ms +0.14%
bench_startup/Turbopack RSC/1000 modules 2346.71ms ± 7.51ms 2369.51ms ± 7.66ms +0.97%
bench_startup/Turbopack SSR/1000 modules 2102.26ms ± 1.40ms 2100.70ms ± 1.91ms -0.07%

@jridgewell
Copy link
Contributor Author

Ping @alexkirsz for review, since you were unlucky enough to emoji the benchmarks 😉

Copy link
Contributor

@alexkirsz alexkirsz left a comment

Choose a reason for hiding this comment

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

:shipit:

@@ -22,10 +22,10 @@ static EMPTY_BUF: &[u8] = &[];

/// A Rope provides an efficient structure for sharing bytes/strings between
/// multiple sources. Cloning a Rope is extremely cheap (Arc and usize), and
/// the sharing contents of one Rope can be shared by just cloning an Arc.
/// the sharing contents of one Rope can be done by just cloning an Arc.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// the sharing contents of one Rope can be done by just cloning an Arc.
/// sharing the contents of one Rope can be done by just cloning an Arc.

}

// At this point, we need to do slower contents equality. It's possible we'll
// still get some memory reference quality for Bytes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// still get some memory reference quality for Bytes.
// still get some memory reference equality for Bytes.

@kodiakhq kodiakhq bot merged commit 6cf7275 into main Feb 28, 2023
@kodiakhq kodiakhq bot deleted the jrl-rope-equality branch February 28, 2023 17:32
jridgewell added a commit that referenced this pull request Feb 28, 2023
ijjk added a commit to vercel/next.js that referenced this pull request Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants