-
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(webidl): optimize createRecordConverter() #12286
Merged
AaronO
merged 4 commits into
denoland:main
from
AaronO:perf/webidl-createRecordConverter
Oct 4, 2021
Merged
perf(webidl): optimize createRecordConverter() #12286
AaronO
merged 4 commits into
denoland:main
from
AaronO:perf/webidl-createRecordConverter
Oct 4, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is not equal. {
const obj = {
a: 1,
get b() {
return 2;
},
};
Reflect.getPrototypeOf(obj).c = 3;
for (const key in obj) {
const val = obj[key];
console.log("for .. in:", key, val);
}
// for .. in: a 1
// for .. in: b 2
// for .. in: c 3
}
{
const obj = {
a: 1,
get b() {
return 2;
},
};
Reflect.getPrototypeOf(obj).c = 3;
const keys = Reflect.ownKeys(obj);
for (const key of keys) {
const val = obj[key];
console.log("Reflect.ownKeys:", key, val);
}
// Reflect.ownKeys: a 1
// Reflect.ownKeys: b 2
} |
Actually, NVM. Inherited keys are filtered out via |
AaronO
added a commit
to AaronO/deno
that referenced
this pull request
Oct 1, 2021
Another binding ... but it's required for denoland#12286 and could be useful elsewhere
Cuts self-time by ~6x, 172ns/iter => 22ns/iter benched on 1M Response builds / HeadersInit calls
AaronO
force-pushed
the
perf/webidl-createRecordConverter
branch
from
October 1, 2021 18:26
1ca8daf
to
7608f77
Compare
aapoalas
reviewed
Oct 2, 2021
lucacasonato
approved these changes
Oct 4, 2021
ry
pushed a commit
that referenced
this pull request
Oct 4, 2021
Cuts self-time by ~6x, 172ns/iter => 22ns/iter benched on 1M Response builds / HeadersInit calls
kurtextrem
reviewed
Oct 5, 2021
AaronO
added a commit
to AaronO/deno
that referenced
this pull request
Oct 5, 2021
In a tweak commit of denoland#12286 I accidentally eliminated the else branch ... running the slow & the fast path providing a worst of both worlds path
AaronO
added a commit
that referenced
this pull request
Oct 5, 2021
bartlomieju
pushed a commit
to bartlomieju/deno
that referenced
this pull request
Oct 10, 2021
In a tweak commit of denoland#12286 I accidentally eliminated the else branch ... running the slow & the fast path providing a worst of both worlds path
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cuts self-time by ~6x, 172ns/iter => 22ns/iter benched on 1M Response builds / HeadersInit calls
This should be functionally identical to the old code since:
for...in
loops on objects iterate over all enumberable string keys of an object (including inherited).hasOwnProperty(...)
Note: WebIDL / WPT is coupled to a subpar implementation so our hands are tied, unless an isProxy fast path check isn't too expensive
Benchmarks
Pending on #12288