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

core(simulator): improved timing typedef #5347

Merged
merged 2 commits into from
May 24, 2018
Merged

Conversation

patrickhulce
Copy link
Collaborator

cleans up a lot of the TODOs left based on the internal/external timing discrepancy

@@ -405,9 +431,20 @@ class Simulator {

return {
timeInMs: totalElapsedTime,
nodeTimings: this._nodeTimings,
nodeTimings: this._computeFinalNodeTimings(),
Copy link
Member

Choose a reason for hiding this comment

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

since we're now emitting a diff shape at the end should we use diff property names to keep totally clear? nodeTimeSpans vs nodeTimings? eh

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would prefer to rename the internal since that's the one that carries more than just timings data

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Which name would you prefer since you were the original ✍️ of nodeTiming ;) #3187 (comment)

@paulirish
Copy link
Member

paulirish commented May 24, 2018 via email

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

nice! LGTM with fix of that one line

@@ -112,7 +112,6 @@ class UsesRelPreloadAudit extends Audit {
const originalNode = originalNodesByRecord.get(node.record);
const timingAfter = simulationAfterChanges.nodeTimings.get(node);
const timingBefore = simulationBeforeChanges.nodeTimings.get(originalNode);
// @ts-ignore TODO(phulce): fix timing typedef
const wastedMs = Math.round(timingBefore.endTime - timingAfter.endTime);
Copy link
Member

Choose a reason for hiding this comment

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

ha, looks like the @ts-ignore was also hiding the possibly undefined (to tsc) response from nodeTimings.get(). I'm good with casting or a runtime check. It would be nice to avoid @ts-ignore since it masks everything in the line, but it also wouldn't be the end of the world

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

whoops yeah, added a check for it! 👍

@patrickhulce patrickhulce merged commit c5743e9 into master May 24, 2018
@patrickhulce patrickhulce deleted the simulator_timing_typdef branch May 24, 2018 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants