Skip to content

perf: cache NativeState→HybridObject dynamic_cast offset per type in HybridFunc. - #1587

Open
riteshshukla04 wants to merge 2 commits into
margelo:mainfrom
riteshshukla04:riteshshukla/dynamic-cache
Open

perf: cache NativeState→HybridObject dynamic_cast offset per type in HybridFunc.#1587
riteshshukla04 wants to merge 2 commits into
margelo:mainfrom
riteshshukla04:riteshshukla/dynamic-cache

Conversation

@riteshshukla04

Copy link
Copy Markdown
Contributor
before-stock-41 55ms after-fix-35 90ms

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
nitro-docs Skipped Skipped Sep 5, 2026 1:25pm UTC

Request Review

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Performance Report

⚠️ Advisory: Results do not fail this PR while the baseline is being calibrated.

iOS

Benchmark Before After Difference
C++ large array (1,024) 62.33 µs 68.78 µs 🔴 +10.35% slower
C++ optional trailing string 228.3 ns 194.9 ns 🟢 -14.6% faster
C++ simpleFunc() 113.1 ns 85.0 ns 🟢 -24.81% faster
C++ number property get/set 211.7 ns 153.6 ns 🟢 -27.45% faster
Swift copy(1 MiB) 91.30 µs 116.69 µs 🔴 +27.82% slower
Swift addNumbers() 134.5 ns 100.4 ns 🟢 -25.35% faster
Swift simpleFunc() 108.2 ns 79.7 ns 🟢 -26.35% faster
Swift number property get/set 248.3 ns 195.7 ns 🟢 -21.19% faster
Swift nested Car struct 3.15 µs 3.64 µs 🔴 +15.37% slower
All Benchmarks
Benchmark Before After Difference
JavaScript addNumbers() 37.2 ns 35.3 ns 🟡 -5.1% faster (noisy)
C++ bounce(1 MiB) 386.6 ns 408.6 ns 🟡 +5.68% slower (noisy)
C++ bounce(4 KiB) 389.7 ns 409.3 ns 🟡 +5.04% slower (noisy)
C++ copy(1 MiB) 94.74 µs 104.21 µs 🟡 +9.99% slower (noisy)
C++ copy(4 KiB) 1.25 µs 1.67 µs 🟡 +33.83% slower (noisy)
C++ small array (16) 1.24 µs 1.32 µs 🟡 +6.38% slower (noisy)
C++ synchronousCallback() 311.2 ns 326.7 ns 🟡 +5% slower (noisy)
C++ create() 615.1 ns 562.0 ns 🟡 -8.63% faster (noisy)
C++ returnExisting() 298.8 ns 278.0 ns 🟡 -6.96% faster (noisy)
C++ typed map (8 entries) 2.69 µs 2.44 µs 🟡 -9.24% faster (noisy)
C++ addNumbers() 128.8 ns 114.7 ns 🟡 -10.9% faster (noisy)
C++ immediatePromise() 1.28 µs 1.29 µs ℹ️ +0.72% slower (advisory)
C++ short ASCII string 213.6 ns 200.8 ns 🟡 -6% faster (noisy)
C++ Unicode string 484.6 ns 454.3 ns 🟡 -6.25% faster (noisy)
C++ nested Car struct 3.20 µs 3.23 µs 🟡 +1.11% slower (noisy)
C++ number | string variant 200.3 ns 184.7 ns 🟡 -7.75% faster (noisy)
Swift bounce(1 MiB) 463.2 ns 432.5 ns 🟡 -6.64% faster (noisy)
Swift bounce(4 KiB) 482.2 ns 414.3 ns 🟡 -14.07% faster (noisy)
Swift copy(4 KiB) 1.81 µs 1.67 µs 🟡 -7.76% faster (noisy)
Swift large array (1,024) 64.94 µs 68.80 µs 🟡 +5.94% slower (noisy)
Swift small array (16) 1.35 µs 1.45 µs 🟡 +7.33% slower (noisy)
Swift synchronousCallback() 447.8 ns 427.8 ns 🟡 -4.47% faster (noisy)
Swift create() 34.28 µs 42.67 µs 🟡 +24.49% slower (noisy)
Swift returnExisting() 379.8 ns 351.5 ns 🟡 -7.44% faster (noisy)
Swift typed map (8 entries) 3.38 µs 3.57 µs 🟡 +5.75% slower (noisy)
Swift optional trailing string 252.3 ns 236.0 ns 🟡 -6.46% faster (noisy)
Swift immediatePromise() 2.22 µs 2.56 µs ℹ️ +15.41% slower (advisory)
Swift short ASCII string 280.6 ns 240.7 ns 🟡 -14.24% faster (noisy)
Swift Unicode string 560.3 ns 576.1 ns 🟡 +2.81% slower (noisy)
Swift number | string variant 330.1 ns 290.6 ns 🟡 -11.96% faster (noisy)
TurboModule addNumbers() 1.46 µs 1.41 µs 🟡 -2.89% faster (noisy)

Android

Benchmark Before After Difference
C++ bounce(1 MiB) 641.9 ns 588.8 ns 🟢 -8.26% faster
C++ copy(4 KiB) 1.55 µs 1.46 µs 🟢 -5.49% faster
C++ create() 1.05 µs 974.2 ns 🟢 -7.48% faster
C++ returnExisting() 396.0 ns 355.6 ns 🟢 -10.21% faster
C++ addNumbers() 173.6 ns 151.8 ns 🟢 -12.55% faster
C++ simpleFunc() 142.9 ns 125.5 ns 🟢 -12.19% faster
C++ number property get/set 299.7 ns 254.0 ns 🟢 -15.25% faster
C++ short ASCII string 259.8 ns 232.7 ns 🟢 -10.43% faster
C++ Unicode string 519.0 ns 476.2 ns 🟢 -8.25% faster
C++ number | string variant 253.3 ns 228.5 ns 🟢 -9.81% faster
Kotlin returnExisting() 1.22 µs 1.13 µs 🟢 -7.73% faster
Kotlin optional trailing string 699.7 ns 642.5 ns 🟢 -8.18% faster
Kotlin addNumbers() 240.4 ns 205.8 ns 🟢 -14.41% faster
Kotlin simpleFunc() 212.1 ns 161.0 ns 🟢 -24.09% faster
Kotlin number property get/set 520.5 ns 424.3 ns 🟢 -18.48% faster
Kotlin short ASCII string 963.4 ns 860.7 ns 🟢 -10.66% faster
Kotlin Unicode string 1.52 µs 1.41 µs 🟢 -7.23% faster
Kotlin number | string variant 883.6 ns 777.9 ns 🟢 -11.96% faster
All Benchmarks
Benchmark Before After Difference
JavaScript addNumbers() 47.1 ns 46.8 ns ⚪ ~0.55% unchanged
C++ bounce(4 KiB) 644.5 ns 616.5 ns 🟡 -4.34% faster (noisy)
C++ copy(1 MiB) 33.64 µs 33.19 µs ⚪ ~1.35% unchanged
C++ large array (1,024) 81.05 µs 80.43 µs ⚪ ~0.76% unchanged
C++ small array (16) 1.61 µs 1.58 µs ⚪ ~2.09% unchanged
C++ synchronousCallback() 512.3 ns 498.2 ns 🟡 -2.74% faster (noisy)
C++ typed map (8 entries) 3.17 µs 3.18 µs ⚪ ~0.37% unchanged
C++ optional trailing string 268.7 ns 259.7 ns ⚪ ~3.37% unchanged
C++ immediatePromise() 1.76 µs 1.72 µs ℹ️ -2.52% faster (advisory)
C++ nested Car struct 4.39 µs 4.26 µs ⚪ ~2.83% unchanged
Kotlin bounce(1 MiB) 1.91 µs 1.83 µs 🟡 -3.78% faster (noisy)
Kotlin bounce(4 KiB) 1.88 µs 1.87 µs 🟡 -0.68% faster (noisy)
Kotlin copy(1 MiB) 494.32 µs 501.35 µs ⚪ ~1.42% unchanged
Kotlin copy(4 KiB) 8.48 µs 8.64 µs 🟡 +1.95% slower (noisy)
Kotlin large array (1,024) 90.22 µs 89.54 µs ⚪ ~0.76% unchanged
Kotlin small array (16) 2.25 µs 2.14 µs ⚪ ~4.56% unchanged
Kotlin synchronousCallback() 1.79 µs 1.74 µs ⚪ ~2.78% unchanged
Kotlin create() 3.25 µs 3.15 µs ⚪ ~3.37% unchanged
Kotlin typed map (8 entries) 13.32 µs 13.18 µs ⚪ ~1.04% unchanged
Kotlin immediatePromise() 5.02 µs 4.96 µs ℹ️ -1.31% faster (advisory)
Kotlin nested Car struct 9.27 µs 9.13 µs ⚪ ~1.52% unchanged
TurboModule addNumbers() 470.3 ns 473.9 ns ⚪ ~0.76% unchanged

Benchmarking Code Diff fe50d8fc...3083c6b5 (view raw output)

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.

2 participants