Skip to content

refactor(webapi): move shared element types into core DOM [Codex] - #415

Draft
jderochervlk wants to merge 1 commit into
feat/isolate-history-locationfrom
feat/core-dom-element-types
Draft

jderochervlk wants to merge 1 commit into
feat/isolate-history-locationfrom
feat/core-dom-element-types

Conversation

@jderochervlk

Copy link
Copy Markdown
Collaborator

Stacked on #413.

Type-only consumers currently need the DOMNodes operation feature just to name an element. Move the concrete DOM-tree, stylesheet, collection, and style-declaration representations into the existing WebAPI.DOM module. Keep the existing API modules and methods in place through representation-preserving aliases.

This preserves public type identities, fields, generic parameters, mutability, privacy, and completion owners. The existing DOM and DOMTree slot-assignment variants remain distinct, including the inference behavior of unannotated DOM.Manual/DOM.Named. Emitted JavaScript for all 338 source modules is unchanged.

React can now select WebAPI.DOM, WebAPI.History, and WebAPI.Location: 6 WebAPI source modules instead of 59. In a fresh five-run comparison, its median clean build fell from 182.26 ms to 145.13 ms. The dependent React change and full raw results belong to jderochervlk/rescript-react#1.

Performance tradeoff

Core now contains more type information. Small standalone DOM, Location, URL, and Fetch consumers had clean-build median increases of approximately 24–32 ms (27–32%) in the same experiment. Keeping React on its old 59-module feature selection also increased its median from 182.26 ms to 215.19 ms. Fewer modules is not an across-the-board compiler optimization; this draft makes the type-ownership/performance tradeoff explicit for review.

Style-input and synthetic-event ownership changes are not included. The live CSSStyleDeclaration representation remains distinct from React style props.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant