-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Design Meeting Notes, 6/18/2024 #58919
Comments
I'd have expected |
Still not really, a for-of-loop is still often many times slower than a for-loop, e.g. this has a difference of 10x in v8 , and 4x in jsc (curiously inlining the forOfLoop function makes v8 have a 4x difference as well): const arr = Array.from({ length: 10_000_000 }, () => Math.random());
function forLoop() {
let sum = 0;
for (let i = 0; i < arr.length; i += 1) {
sum += arr[i];
}
}
function forOfLoop() {
let sum = 0;
for (const v of arr) {
sum += v;
}
}
console.time("for-loop");
for (let i = 0; i < 100; i += 1) {
forLoop();
}
console.timeEnd("for-loop");
console.time("for-of-loop");
for (let i = 0; i < 100; i += 1) {
forOfLoop();
}
console.timeEnd("for-of-loop"); |
Coverage Reporting
#58850
npm tests -- --no-lint --coverage
.Knip
#56817
/** @knipignore */
tag to the preceding comment.@internal
Tagging--stripInternal
is supposed to do, and say it only applies to JSDoc comments.// Do not add an @internal tag to the next declaration
, since TypeScript will now consider that unrelated.--stripInternal
, we've always said "it has bugs, ehhh, arguable behavior."More "Primitive" Operations in Core Utilities
#58873
some
function was just a big hot path.||
checks for truthiness, but??
only checks fornull
/undefined
.undefined
are faster than truthiness.for
-of
loops create iterators butfor (let i = 0; i < arr.length; i++)
doesn't.core.ts
to avoid too much noise.The text was updated successfully, but these errors were encountered: