Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use faster mechanism for type checks against DOM nodes #403

Merged
merged 2 commits into from
Mar 24, 2025

Conversation

mkustermann
Copy link
Contributor

@mkustermann mkustermann commented Mar 19, 2025

The

  • <node>.isA<HTMLInputElement>() and
  • <node>.instanceOfString('HTMLInputElement')

APIs are currently performing poorly, see [0].

Instead we use <node>.instanceof(<constructor>) with a cached value of the looked up constructor.
=> This results in 5-10x faster type checks in dart2wasm.

[0] dart-lang/sdk#60344

The

  * `<node>.isA<HTMLInputElement>()` and
  * `<node>.instanceOfString('HTMLInputElement')`

APIs are currently performing poorly, see [0].

Instead we use `<node>.instanceof(<constructor>)` with a cached value of
the looked up constructor. This results in 5-10x faster type checks in
dart2wasm.

[0] dart-lang/sdk#60344
@mkustermann mkustermann requested a review from schultek as a code owner March 19, 2025 12:27
Copy link

docs-page bot commented Mar 19, 2025

To view this pull requests documentation preview, visit the following URL:

docs.page/schultek/jaspr~403

Documentation is deployed and generated using docs.page.

Copy link

Package Version Report

The following packages have been updated:
jaspr : 0.18.0 -> 0.18.1
jaspr_builder : 0.18.0 -> 0.18.1
jaspr_cli : 0.18.0 -> 0.18.1
jaspr_test : 0.18.0 -> 0.18.1

Copy link
Owner

@schultek schultek left a comment

Choose a reason for hiding this comment

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

Great stuff, thanks!

@schultek schultek merged commit d25dd70 into schultek:main Mar 24, 2025
3 checks passed
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