Skip to content

Add indexed runtime identity path and hot-path benchmarks#1483

Merged
steve-the-edwards merged 7 commits intomainfrom
sedwards/no-ticket/main-rebase-20260311
Mar 12, 2026
Merged

Add indexed runtime identity path and hot-path benchmarks#1483
steve-the-edwards merged 7 commits intomainfrom
sedwards/no-ticket/main-rebase-20260311

Conversation

@steve-the-edwards
Copy link
Copy Markdown
Contributor

@steve-the-edwards steve-the-edwards commented Mar 11, 2026

Optimize the 'uniqueness' check that happens as we add nodes to the staging list - this happens on every render for every node. Currently we had to walk the linked list, but now we keep a set of identities for the nodes (the key set of a map) so we can check if it 'contains'. This is in addition to the actual ActiveStagingList so we keep it as a LinkedList for the actual swaps.

  • gate indexed runtime behavior behind the new experimental runtime option INDEXED_ACTIVE_STAGING_LISTS
  • add targeted runtime tests for indexed behavior and uniqueness semantics
  • add runtime microbenchmarks for wide sibling-key churn, remember-heavy paths, and stable event handler pressure

Validation

  • ./gradlew :workflow-runtime:jvmTest --tests "*ActiveStagingListTest" --tests "*SubtreeManagerTest" --tests "*WorkflowNodeTest"
  • ./gradlew :benchmarks:runtime-microbenchmark:compileReleaseAndroidTestKotlin
  • ./gradlew :benchmarks:runtime-microbenchmark:connectedReleaseAndroidTest -Pandroidx.benchmark.dryRunMode.enable=true
  • ANDROID_SERIAL=1C041FDF60017G ./gradlew :benchmarks:runtime-microbenchmark:connectedReleaseAndroidTest (Pixel 6 / Android 16, 56/56 tests passed)

On-Device Benchmark Highlights (Median µs)

Device: Pixel 6 (oriole), Android 16 (SDK 36).

Scenario No Opt All Opt Speedup
wideSiblingKeys_initialRenderAllChildren 2517.749 1316.338 1.91x
wideSiblingKeys_rerenderSingleSiblingByPropsChange 1745.811 451.559 3.87x
rememberManyEntries_sameInputs 227.852 175.595 1.30x
rememberManyEntries_changingInputs 495.340 192.561 2.57x
rememberManyEntries_mixedInputTypes 537.550 220.742 2.44x
stableHandlers_manyCallbacks_propChange 203.705 170.639 1.19x

@steve-the-edwards
Copy link
Copy Markdown
Contributor Author

Correction: completed a fresh local review pass of the PR diff (main...HEAD) and found no additional code changes needed. I updated the PR description to explicitly document RuntimeConfigOptions.INDEXED_ACTIVE_STAGING_LISTS as experimental, default-off, and the behavior when enabled, plus the latest validation commands.

@steve-the-edwards steve-the-edwards marked this pull request as ready for review March 12, 2026 13:42
steve-the-edwards and others added 5 commits March 12, 2026 09:50
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Amp <amp@ampcode.com>
Ai-assisted: true
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Amp <amp@ampcode.com>
Ai-assisted: true
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Amp <amp@ampcode.com>
Ai-assisted: true
@steve-the-edwards steve-the-edwards force-pushed the sedwards/no-ticket/main-rebase-20260311 branch from 4d7a76c to 65f0945 Compare March 12, 2026 13:50
steve-the-edwards and others added 2 commits March 12, 2026 13:53
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@steve-the-edwards steve-the-edwards merged commit 6c20e7d into main Mar 12, 2026
78 checks passed
@steve-the-edwards steve-the-edwards deleted the sedwards/no-ticket/main-rebase-20260311 branch March 12, 2026 15:32
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