-
Notifications
You must be signed in to change notification settings - Fork 119
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
Switch dart:js and some dart:js_util usages to use static interop #3299
Conversation
7385f75
to
8c59543
Compare
@parlough – without loading the diff locally – what's the byte/% delta? |
@kevmoo There's very few usages of the APIs here, so the reduction isn't too large: 209244 bytes -> 201998 bytes or a ≈3.5% reduction when compiled with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine to me! The staticInterop docs are pretty ... slim. Are there benefits to this?
8K is a LOT for the small delta here! Awesome!
…On Thu, Jan 19, 2023 at 1:37 PM Parker Lougheed ***@***.***> wrote:
There's very few usages of the APIs here, so the reduction isn't too
large: 209244 bytes -> 201998 bytes or a ≈3.5% reduction when compiled with
-O4.
—
Reply to this email directly, view it on GitHub
<#3299 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEFCSLJMBZ2G7L64BFRSDWTGXZDANCNFSM6AAAAAAT3OZBSI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Yup - dart-lang/site-www#4331 |
The README for package:js has some extra context too: https://github.com/dart-lang/sdk/tree/main/pkg/js#staticinterop |
@@ -1,7 +1,7 @@ | |||
import 'package:js/js.dart'; | |||
import 'package:js/js_util.dart' as js_util; | |||
|
|||
@JS() | |||
@JS('Response') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: This is fine and suggested to keep, but is unneeded, since FetchResponse
has no constructor or static methods, which would be the only time we use this.
Super cool to see the changes here, thanks for doing this! |
@parlough – are you able to merge – or do you want me to do it? |
@kevmoo I don't have commit/write access on dartdoc, so all you :) |
A little initial exploration into static JS interop to replace dartdoc's current usages of
dart:js
and some usagesdart:js_util
. This is closer to what JS-interop will likely look like in the future with inline classes, has some size benefits, and will make it easier to enablestrict-casts
.Looks like there is even a little size decrease :D - 209244 bytes -> 201998 bytes or a ≈3.5% reduction when compiled with
-O4
.