Skip to content
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

Fix dependency order and observer registration #41253

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

rbuckton
Copy link
Member

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.

@@ -84,7 +84,7 @@ namespace ts {
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
Member 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)

@@ -13,10 +13,10 @@
"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
Member 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

4 participants