Skip to content

Add IntersectionObserver performance benchmarks (#60309) - #60309

Open
rubennorte wants to merge 1 commit into
react:mainfrom
rubennorte:export-D134252378
Open

rubennorte wants to merge 1 commit into
react:mainfrom
rubennorte:export-D134252378

Conversation

@rubennorte

@rubennorte rubennorte commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Summary:

Context

Benchmarks should cover how IntersectionObserver is normally configured: one or two thresholds, with ten and one hundred as bounds.

Changes

Keep all public benchmark additions in this first, benchmark-only diff. Cover 1, 2, 10, and 100 thresholds, deep implicit/explicit roots, and target/root ratio reads. Parameterize callback-count assertions for the threshold count. No runtime implementation or API threshold-count limit is changed.

Baseline benchmark results

Optimized Fantom (native + Hermes bytecode), headless Linux, fixed CPU affinity. This benchmark-only baseline includes landed scrollMargin support, but no runtime changes from this stack. Values are median CPU time per complete invocation from the current run; setup/assertions are outside timed work. Scaling cases have 100 measured invocations and cover 1/2 thresholds plus 10/100 bounds.

Benchmark Baseline CPU
Read intersectionRatio 1000 times 5.105 ms
Read rnRootIntersectionRatio 1000 times 4.962 ms
Scroll 100 targets, depth 1, 1 thresholds, implicit root 7.238 ms
Scroll 100 targets, depth 1, 2 thresholds, implicit root 7.513 ms
Scroll 100 targets, depth 1, 10 thresholds, implicit root 8.560 ms
Scroll 100 targets, depth 1, 100 thresholds, implicit root 20.442 ms
Scroll 100 targets, depth 40, 1 thresholds, implicit root 38.032 ms
Scroll 100 targets, depth 40, 1 thresholds, explicit root 46.293 ms

Scrolling includes mounting and intersection computation, plus callbacks when thresholds are crossed. Ratio rows measure consumer reads, not notification dispatch.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D134252378

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 26, 2026
@meta-codesync

meta-codesync Bot commented Nov 26, 2026

Copy link
Copy Markdown

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D134252378.

@javache javache left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

Summary:

## Context

Benchmarks should cover how IntersectionObserver is normally configured: one or two thresholds, with ten and one hundred as bounds.

## Changes

Keep all public benchmark additions in this first, benchmark-only diff. Cover 1, 2, 10, and 100 thresholds, deep implicit/explicit roots, and target/root ratio reads. Parameterize callback-count assertions for the threshold count. No runtime implementation or API threshold-count limit is changed.

## Baseline benchmark results

Optimized Fantom (native + Hermes bytecode), headless Linux, fixed CPU affinity. This benchmark-only baseline includes landed scrollMargin support, but no runtime changes from this stack. Values are median CPU time per complete invocation from the current run; setup/assertions are outside timed work. Scaling cases have 100 measured invocations and cover 1/2 thresholds plus 10/100 bounds.

| Benchmark | Baseline CPU |
| --- | --- |
| `Read intersectionRatio 1000 times` | 5.105 ms |
| `Read rnRootIntersectionRatio 1000 times` | 4.962 ms |
| `Scroll 100 targets, depth 1, 1 thresholds, implicit root` | 7.238 ms |
| `Scroll 100 targets, depth 1, 2 thresholds, implicit root` | 7.513 ms |
| `Scroll 100 targets, depth 1, 10 thresholds, implicit root` | 8.560 ms |
| `Scroll 100 targets, depth 1, 100 thresholds, implicit root` | 20.442 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, implicit root` | 38.032 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, explicit root` | 46.293 ms |

Scrolling includes mounting and intersection computation, plus callbacks when thresholds are crossed. Ratio rows measure consumer reads, not notification dispatch.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D134252378
@meta-codesync meta-codesync Bot changed the title Add IntersectionObserver performance benchmarks Add IntersectionObserver performance benchmarks (#60309) Nov 26, 2026
rubennorte added a commit to rubennorte/react-native that referenced this pull request Nov 26, 2026
Summary:

## Context

Benchmarks should cover how IntersectionObserver is normally configured: one or two thresholds, with ten and one hundred as bounds.

## Changes

Keep all public benchmark additions in this first, benchmark-only diff. Cover 1, 2, 10, and 100 thresholds, deep implicit/explicit roots, and target/root ratio reads. Parameterize callback-count assertions for the threshold count. No runtime implementation or API threshold-count limit is changed.

## Baseline benchmark results

Optimized Fantom (native + Hermes bytecode), headless Linux, fixed CPU affinity. This benchmark-only baseline includes landed scrollMargin support, but no runtime changes from this stack. Values are median CPU time per complete invocation from the current run; setup/assertions are outside timed work. Scaling cases have 100 measured invocations and cover 1/2 thresholds plus 10/100 bounds.

| Benchmark | Baseline CPU |
| --- | --- |
| `Read intersectionRatio 1000 times` | 5.105 ms |
| `Read rnRootIntersectionRatio 1000 times` | 4.962 ms |
| `Scroll 100 targets, depth 1, 1 thresholds, implicit root` | 7.238 ms |
| `Scroll 100 targets, depth 1, 2 thresholds, implicit root` | 7.513 ms |
| `Scroll 100 targets, depth 1, 10 thresholds, implicit root` | 8.560 ms |
| `Scroll 100 targets, depth 1, 100 thresholds, implicit root` | 20.442 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, implicit root` | 38.032 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, explicit root` | 46.293 ms |

Scrolling includes mounting and intersection computation, plus callbacks when thresholds are crossed. Ratio rows measure consumer reads, not notification dispatch.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D134252378
rubennorte added a commit to rubennorte/react-native that referenced this pull request Nov 26, 2026
Summary:

## Context

Benchmarks should cover how IntersectionObserver is normally configured: one or two thresholds, with ten and one hundred as bounds.

## Changes

Keep all public benchmark additions in this first, benchmark-only diff. Cover 1, 2, 10, and 100 thresholds, deep implicit/explicit roots, and target/root ratio reads. Parameterize callback-count assertions for the threshold count. No runtime implementation or API threshold-count limit is changed.

## Baseline benchmark results

Optimized Fantom (native + Hermes bytecode), headless Linux, fixed CPU affinity. This benchmark-only baseline includes landed scrollMargin support, but no runtime changes from this stack. Values are median CPU time per complete invocation from the current run; setup/assertions are outside timed work. Scaling cases have 100 measured invocations and cover 1/2 thresholds plus 10/100 bounds.

| Benchmark | Baseline CPU |
| --- | --- |
| `Read intersectionRatio 1000 times` | 5.105 ms |
| `Read rnRootIntersectionRatio 1000 times` | 4.962 ms |
| `Scroll 100 targets, depth 1, 1 thresholds, implicit root` | 7.238 ms |
| `Scroll 100 targets, depth 1, 2 thresholds, implicit root` | 7.513 ms |
| `Scroll 100 targets, depth 1, 10 thresholds, implicit root` | 8.560 ms |
| `Scroll 100 targets, depth 1, 100 thresholds, implicit root` | 20.442 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, implicit root` | 38.032 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, explicit root` | 46.293 ms |

Scrolling includes mounting and intersection computation, plus callbacks when thresholds are crossed. Ratio rows measure consumer reads, not notification dispatch.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D134252378
rubennorte added a commit to rubennorte/react-native that referenced this pull request Nov 26, 2026
Summary:

## Context

Benchmarks should cover how IntersectionObserver is normally configured: one or two thresholds, with ten and one hundred as bounds.

## Changes

Keep all public benchmark additions in this first, benchmark-only diff. Cover 1, 2, 10, and 100 thresholds, deep implicit/explicit roots, and target/root ratio reads. Parameterize callback-count assertions for the threshold count. No runtime implementation or API threshold-count limit is changed.

## Baseline benchmark results

Optimized Fantom (native + Hermes bytecode), headless Linux, fixed CPU affinity. This benchmark-only baseline includes landed scrollMargin support, but no runtime changes from this stack. Values are median CPU time per complete invocation from the current run; setup/assertions are outside timed work. Scaling cases have 100 measured invocations and cover 1/2 thresholds plus 10/100 bounds.

| Benchmark | Baseline CPU |
| --- | --- |
| `Read intersectionRatio 1000 times` | 5.105 ms |
| `Read rnRootIntersectionRatio 1000 times` | 4.962 ms |
| `Scroll 100 targets, depth 1, 1 thresholds, implicit root` | 7.238 ms |
| `Scroll 100 targets, depth 1, 2 thresholds, implicit root` | 7.513 ms |
| `Scroll 100 targets, depth 1, 10 thresholds, implicit root` | 8.560 ms |
| `Scroll 100 targets, depth 1, 100 thresholds, implicit root` | 20.442 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, implicit root` | 38.032 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, explicit root` | 46.293 ms |

Scrolling includes mounting and intersection computation, plus callbacks when thresholds are crossed. Ratio rows measure consumer reads, not notification dispatch.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D134252378
rubennorte added a commit to rubennorte/react-native that referenced this pull request Nov 26, 2026
Summary:

## Context

Benchmarks should cover how IntersectionObserver is normally configured: one or two thresholds, with ten and one hundred as bounds.

## Changes

Keep all public benchmark additions in this first, benchmark-only diff. Cover 1, 2, 10, and 100 thresholds, deep implicit/explicit roots, and target/root ratio reads. Parameterize callback-count assertions for the threshold count. No runtime implementation or API threshold-count limit is changed.

## Baseline benchmark results

Optimized Fantom (native + Hermes bytecode), headless Linux, fixed CPU affinity. This benchmark-only baseline includes landed scrollMargin support, but no runtime changes from this stack. Values are median CPU time per complete invocation from the current run; setup/assertions are outside timed work. Scaling cases have 100 measured invocations and cover 1/2 thresholds plus 10/100 bounds.

| Benchmark | Baseline CPU |
| --- | --- |
| `Read intersectionRatio 1000 times` | 5.105 ms |
| `Read rnRootIntersectionRatio 1000 times` | 4.962 ms |
| `Scroll 100 targets, depth 1, 1 thresholds, implicit root` | 7.238 ms |
| `Scroll 100 targets, depth 1, 2 thresholds, implicit root` | 7.513 ms |
| `Scroll 100 targets, depth 1, 10 thresholds, implicit root` | 8.560 ms |
| `Scroll 100 targets, depth 1, 100 thresholds, implicit root` | 20.442 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, implicit root` | 38.032 ms |
| `Scroll 100 targets, depth 40, 1 thresholds, explicit root` | 46.293 ms |

Scrolling includes mounting and intersection computation, plus callbacks when thresholds are crossed. Ratio rows measure consumer reads, not notification dispatch.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D134252378

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants