Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ jobs:
- run: npm ci
- run: npm run build
- run: python3 benchmarks/check-consumer.py
- run: npm run test:dom-props
- run: npm run test
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ npm start
See [the WebAPI profiling report](benchmarks/README.md) for the built-in DOM
migration, build measurements, and local-link reproduction commands.

The intrinsic DOM props and ref types are owned by `ReactDOM`, not by the built-in
`JsxDOM` module. Use `ReactDOM.domProps`, `ReactDOM.domRef`, and the
`ReactDOM.Ref` helpers instead of explicitly annotating values with `JsxDOM` types.
Popover constructors now live here too, for example `ReactDOM.Auto` and `ReactDOM.Toggle`.
The separate `JsxDOMStyle` and `JsxEvent` aliases are not migrated yet.

Run the DOM props regression checks with Node.js and Python 3 available:

```sh
npm run test:dom-props
```

This checks the complete prop surface against the pinned compiler's definitions,
then builds a disposable consumer with the `JsxDOM` module removed from a private
runtime copy. It checks JSX and server-rendering behavior, plus rejection of
invalid props, styles, event handlers, and refs. Shared dependencies are not modified.

Event targets, native events, and FormData files now use WebAPI's core types.
`currentTarget` and UI/pointer `view` return options to handle absent values.
Clipboard data is an optional WebAPI DataTransfer, touch getters return
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ final ten-sample comparison were 196.98 ms for the migrated 59-module selection,
15-module layout. The reduced layouts are effectively tied at this sample size.

PR #2 retains only the separate JsxDOM props/ref removal on top of this base.
Its new [before/after benchmark report](jsxdom-report.md) measures that change
against a fresh PR #1 control, with exact source revisions and timestamps:
clean medians are 182.87 ms before and 208.52 ms after (ten samples each).
Those measurements are separate from the older layout comparison above.
The six-module investigation below is preserved as historical evidence, not the
current implementation or a new measurement of the follow-up.

Expand Down
114 changes: 114 additions & 0 deletions benchmarks/jsxdom-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# JsxDOM removal: PR #2 build timings

Historical 15-module comparison. The current 27-module data-feature base and
refreshed PR #2 before/after timings are in
[data-feature-report.md](data-feature-report.md).

This measures the additional cost of owning React's intrinsic props/ref types
locally, after the 15-module WebAPI migration in PR #1. It does not measure the
still-pending removal of `JsxDOMStyle` or `JsxEvent`.

Both source snapshots predate the later [core-backed event/file type
strengthening](webapi-type-strengthening.md). That follow-up is inherited by
PR #2, but these timings have not been relabeled as measurements of newer sources.

## Same-session before/after results

ReScript **13.0.0-alpha.7**. Median wall-clock milliseconds, **10 samples per
mode per version**, pooled from two blocks of five:

| Source snapshot | Clean | Cached no-op | Single-file rebuild |
| --- | ---: | ---: | ---: |
| PR #1: before JsxDOM removal | 182.87 | 58.92 | 97.36 |
| PR #2: after JsxDOM removal | **208.52** | **61.76** | **121.91** |
| Difference in medians | +25.65 | +2.84 | +24.55 |

Ranges (minimum–maximum milliseconds):

| Source snapshot | Clean | Cached no-op | Single-file rebuild |
| --- | ---: | ---: | ---: |
| Before | 164.21–237.43 | 46.72–74.04 | 70.44–113.44 |
| After | 191.15–234.44 | 53.40–70.15 | 100.64–140.36 |

The clean and edited-build medians are higher after the change in both blocks.
Cached-build ranges overlap substantially. This experiment does **not** show a
build-speed improvement from removing JsxDOM, and is not a general compiler
performance guarantee.

Both versions compile **15 WebAPI + 9 React = 24 source modules**. Removing an
alias to a precompiled runtime type does not remove one of those source modules;
PR #2 instead puts the intrinsic-props record in React's own compilation.
That is a plausible source of extra work, not a compiler-profiled attribution.
The incremental edit recompiles two modules in both versions.

Do not compare these absolute timings directly with PR #1's older 122.27 ms
15-module median or the original no-WebAPI v12/v13 baselines. Those came from
different sessions. The freshly measured PR #1 row above is the control here.

## Exact revisions and timestamps

- Before: `9ab058ca78be7fec01f3b6001f5683f4cf5a5f02` (PR #1).
- After: `5410e8095a2c57498b226b50da662bffcd579bf5` (PR #2).
- Shared WebAPI: `81ac4eebeae3ff0cc9118e7b4b62323e3cee9729`.
- Shared WebAPI input SHA-256:
`de9a938ec0d196dd0da1553a4f9c1346f8c3fe22d5488e6b9d063ce1e81ae118`.

Each raw result's `recorded_at` timestamp is captured after fixture setup,
before its warm-up and measured builds. It is a **block timestamp**, not an
individual sample timestamp:

| Execution order | Recorded at (local offset included) | Raw samples and build logs |
| --- | --- | --- |
| Before A | `2026-11-17T06:45:47-0500` | [jsxdom-before-a.json](results/jsxdom-before-a.json) |
| After A | `2026-11-17T06:45:51-0500` | [jsxdom-after-a.json](results/jsxdom-after-a.json) |
| After B | `2026-11-17T06:45:55-0500` | [jsxdom-after-b.json](results/jsxdom-after-b.json) |
| Before B | `2026-11-17T06:45:58-0500` | [jsxdom-before-b.json](results/jsxdom-before-b.json) |

The results' `source_ref` identifies the measured source revision.
`react_commit` identifies the harness checkout, which stayed on PR #2 throughout.
Source hashes were checked against each `source_ref`; only ReactDOM.res,
ReactEvent.res, and ReactEvent.resi differ between the measured source sets.
The effective ReScript configuration and WebAPI fingerprint match in all blocks.

## Method

- Used the existing `builds.py` harness without changes: **60 measured builds**.
- Executed sequentially, before → after in block A, after → before in block B.
No parallel benchmark or validation builds were launched.
- Each scenario gets a separate React fixture and an untimed warm-up. All link
the same private local WebAPI source snapshot, archived from the exact commit
without its development dependencies. The external WebAPI checkout is untouched.
- Build timing includes compiler startup, but excludes npm installation and
cleanup. Clean removes compiler artifacts, not OS page caches or the installed
precompiled runtime. The harness checks for leftover WebAPI build artifacts.
- Cached builds change no source. Edited builds append an exported
`benchmarkIteration` value to the fixture's ReactDOMStyle.res, then restore it.
- Linux x86_64, eight logical CPUs; Node `v24.16.0`, npm `11.15.0`,
React and React DOM `19.2.0`. No CPU-frequency or system-load isolation.
- This is a library-build benchmark, not an application JSX compilation or runtime
benchmark. It does not rerun the DOM-props behavioral regression suite.

## Reproduce

Prepare a local WebAPI source snapshot at the shared revision above, without
installed development dependencies. Then run the following sequentially, choosing
new scenario names if fixtures with these names already exist:

```sh
for pair in \
"before-a 9ab058ca78be7fec01f3b6001f5683f4cf5a5f02" \
"after-a 5410e8095a2c57498b226b50da662bffcd579bf5" \
"after-b 5410e8095a2c57498b226b50da662bffcd579bf5" \
"before-b 9ab058ca78be7fec01f3b6001f5683f4cf5a5f02"
do
set -- $pair
python3 benchmarks/builds.py "jsxdom-repeat-$1" --compiler 13 --runs 5 \
--source-ref "$2" --webapi /path/to/private-webapi-snapshot \
--webapi-source-ref 81ac4eebeae3ff0cc9118e7b4b62323e3cee9729 \
--feature WebAPI.DOMTree --feature WebAPI.History --feature WebAPI.Location
done
```

The harness writes compiler artifacts into the linked snapshot; do not use it
concurrently for other builds. Raw JSON includes every sample, compiler log,
configuration, source hashes, timestamp, and compiled-module inventory.
207 changes: 207 additions & 0 deletions benchmarks/results/jsxdom-after-a.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"scenario": "jsxdom-after-a",
"compiler": "13.0.0-alpha.7",
"recorded_at": "2026-11-17T06:45:51-0500",
"react_commit": "5410e8095a2c57498b226b50da662bffcd579bf5",
"source_ref": "5410e8095a2c57498b226b50da662bffcd579bf5",
"probe": null,
"platform": "Linux-7.2.9-1-MANJARO-x86_64-with-glibc2.44",
"cpu_count": 8,
"node": "v24.16.0",
"npm": "11.15.0",
"webapi": "/home/josh/Dev/rescript-react/.delta/worktrees/jsswxvp74w80/rescript-react/node_modules/.jsxdom-profile-webapi",
"features": [
"WebAPI.DOMTree",
"WebAPI.History",
"WebAPI.Location"
],
"sources": {
"src/React.res": "65b34f706818a620d97c2a42e42dc1e0883aa5149480858677c12269466ddad5",
"src/ReactDOM.res": "7b0304b03f8aebcd83e89a121f618b8818b362d7d7db0ea1f010925a0ebe1ae3",
"src/ReactDOMServer.res": "2be8757a8fd3e60280313faa4c75d1c6f77b4b99dc4042cb0a043c0999ab0d10",
"src/ReactDOMStatic.res": "1296d7932d043a040b6c59ee5cd014374a4a063a13ee75c9c95fd0324e7e31f9",
"src/ReactDOMStyle.res": "a2836a0764364b9bcbd0fc090432c711aecad7b91ffc83dfd9c4e26fb2e7ed2e",
"src/ReactEvent.res": "13538573814569ce56e41a6d5f36e8f67ca0cbcccdf7d9adbac0df39af536d7c",
"src/ReactEvent.resi": "ae6f83946cc6b251a26a09de167b6a252feb2ca183e420a18e15e0531135744e",
"src/ReactTestUtils.res": "86bd87d05c94db682eb762cc0270f35b2402016f23ef90370294f3e3d78bc341",
"src/ReactTestUtils.resi": "a24e9869884a0aa4612fe02bd5809ffb20cb2864b4291e42ec2b875c82163357",
"src/RescriptReactErrorBoundary.res": "7fab116e5e519687faa1ef91066accf7cea3698bc774538c6bff65d3f9a328c3",
"src/RescriptReactErrorBoundary.resi": "5dd0c5018531f28a31802172a8b70e07aa3e747e02629a546d49fe902da523e2",
"src/RescriptReactRouter.res": "2df77b3609d86e636f0abf1a2e3cb3e50365b44ca7689254e2b51450df4227a1",
"src/RescriptReactRouter.resi": "b2a7daa2be5b4e3ca1ac9ac4f838bf1350edf552eac5170e3381a7b05b0dc399"
},
"config": {
"name": "@rescript/react",
"jsx": {
"version": 4
},
"sources": [
{
"dir": "src"
}
],
"package-specs": [
{
"module": "esmodule",
"in-source": true
}
],
"suffix": ".res.js",
"dependencies": [
{
"name": "@rescript/webapi",
"features": [
"WebAPI.DOMTree",
"WebAPI.History",
"WebAPI.Location"
]
}
]
},
"webapi_commit": null,
"webapi_status": null,
"webapi_source_ref": "81ac4eebeae3ff0cc9118e7b4b62323e3cee9729",
"webapi_inputs_sha256": "de9a938ec0d196dd0da1553a4f9c1346f8c3fe22d5488e6b9d063ce1e81ae118",
"samples": [
{
"iteration": 1,
"mode": "clean",
"ms": 203.258065,
"log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n"
},
{
"iteration": 1,
"mode": "cached",
"ms": 53.4023,
"log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n"
},
{
"iteration": 1,
"mode": "edit",
"ms": 126.673949,
"log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n"
},
{
"iteration": 2,
"mode": "clean",
"ms": 208.646775,
"log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n"
},
{
"iteration": 2,
"mode": "cached",
"ms": 63.983013,
"log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n"
},
{
"iteration": 2,
"mode": "edit",
"ms": 113.458766,
"log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n"
},
{
"iteration": 3,
"mode": "clean",
"ms": 199.121289,
"log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n"
},
{
"iteration": 3,
"mode": "cached",
"ms": 70.153819,
"log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n"
},
{
"iteration": 3,
"mode": "edit",
"ms": 100.638416,
"log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n"
},
{
"iteration": 4,
"mode": "clean",
"ms": 191.152914,
"log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n"
},
{
"iteration": 4,
"mode": "cached",
"ms": 69.590388,
"log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n"
},
{
"iteration": 4,
"mode": "edit",
"ms": 121.414975,
"log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n"
},
{
"iteration": 5,
"mode": "clean",
"ms": 210.692128,
"log": "Cleaned 0/0\nParsed 24 source files\nCompiled 24 modules\n"
},
{
"iteration": 5,
"mode": "cached",
"ms": 57.907987,
"log": "Cleaned 0/28\nParsed 0 source files\nCompiled 0 modules\n"
},
{
"iteration": 5,
"mode": "edit",
"ms": 140.363394,
"log": "Cleaned 0/28\nParsed 1 source files\nCompiled 2 modules\n"
}
],
"summary": {
"clean": {
"median_ms": 203.258065,
"min_ms": 191.152914,
"max_ms": 210.692128,
"mean_ms": 202.5742342
},
"cached": {
"median_ms": 63.983013,
"min_ms": 53.4023,
"max_ms": 70.153819,
"mean_ms": 63.0075014
},
"edit": {
"median_ms": 121.414975,
"min_ms": 100.638416,
"max_ms": 140.363394,
"mean_ms": 120.5099
}
},
"artifacts": {
"react": {
".cmi": 18,
".cmj": 18,
".ast": 18
},
"webapi": {
".cmi": 32,
".cmj": 32,
".ast": 30
}
},
"webapi_compiled_modules": [
"WebAPI.cmj",
"src/core/ArrayBufferTypedArrayOrDataView-WebAPI.cmj",
"src/core/DOM-WebAPI.cmj",
"src/core/EventType-WebAPI.cmj",
"src/cssom-core/CSSStyleDeclaration-WebAPI.cmj",
"src/cssom-core/CSSStyleValue-WebAPI.cmj",
"src/cssom-core/MediaList-WebAPI.cmj",
"src/cssom-core/StylePropertyMap-WebAPI.cmj",
"src/cssom-core/StylePropertyMapReadOnly-WebAPI.cmj",
"src/cssom-core/StyleSheet-WebAPI.cmj",
"src/cssom-core/StyleSheetList-WebAPI.cmj",
"src/dom-tree/DOMStringMap-WebAPI.cmj",
"src/dom-tree/DOMTree-WebAPI.cmj",
"src/history/History-WebAPI.cmj",
"src/history/HistoryTypes-WebAPI.cmj",
"src/location/Location-WebAPI.cmj"
]
}
Loading
Loading