-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
perf(ext/fetch): Use the WebIDL conversion to DOMString rather than USVString for Response constructor #12201
perf(ext/fetch): Use the WebIDL conversion to DOMString rather than USVString for Response constructor #12201
Conversation
…SVString for Response constructor
This is not correct though. USVString normalization doesn't happen at all now. |
The |
@@ -393,7 +393,7 @@ | |||
return webidl.converters["ArrayBufferView"](V, opts); | |||
} | |||
} | |||
return webidl.converters["USVString"](V, opts); | |||
return webidl.converters["DOMString"](V, opts); |
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.
BodyInit
is a WebIDL union type defined in the fetch specification. As I suggested in #12168 (comment), you should probably define a different WebIDL type (BodyInit_DOMString
for example), to avoid confusion.
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.
@andreubotella, what would you suggest to do with the nullable converter BodyInit?
? Should I rename it too?
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.
That's right
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.
Renamed.
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.
LGTM, thanks @lmalheiro and @andreubotella
Fixes performance issue #12090
Replaces conversion to
USVString
byDOMString
at theBodyInit
WebIDL conversion.Adds benchmark
response_string
which produced the following results before and after the change:USVString
:DOMString
:Notice that the difference will increase non-linearly for larger strings.
This pull request replaces #12093