Skip to content

Conversation

@rbuckton
Copy link
Contributor

Fixes a dependency ordering issue in #40593 and correctly handles that PerformanceObserver's callback is called each time a mark or measure is recorded, not just once.

These issues were detected when running perf tests on another PR.

performance.mark(end);
}
performance.measure(name, start, end);
if (end = "__performance.measure-fix__") {
Copy link
Member

Choose a reason for hiding this comment

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

Hm... Should we have a lint for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or a --strictBoolean (or --pedanticBoolean?) flag that requires all conditions be boolean (including !). It wouldn't catch if (f = true), but it also would mean you'd have to write a lot of if (obj !== null && obj !== undefined) instead of if (obj) because !!obj would also be a violation...

Copy link
Member

Choose a reason for hiding this comment

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

while (next = read()) seems like a sane pattern, so this feels more like a heuristic than a compiler error. Having said that, I would probably personally use such a mode, assuming it had a (totally reasonable) exception for !!expr.

Copy link
Member

Choose a reason for hiding this comment

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

I mean, mostly just using = in an if without a reference to the assigned variable within the if. (Since I know we do this intentionally in relationship checking, but the difference there is we actually reference the checked variable)

"corePublic.ts",
"core.ts",
"debug.ts",
"semver.ts",
Copy link
Member

Choose a reason for hiding this comment

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

Does this need a comment so it doesn't get alphabetized back?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These should never be alphabetized, they are all order dependent.

@rbuckton rbuckton merged commit 90e944d into master Oct 26, 2020
@rbuckton rbuckton deleted the nativePerformanceHooks2 branch October 26, 2020 19:56
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants