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

lantern: keep first layout/paint/parse events regardless of duration #9922

Merged
merged 13 commits into from
Jan 15, 2020

Conversation

connorjclark
Copy link
Collaborator

@connorjclark connorjclark commented Nov 5, 2019

Fixes #9627

Lantern

image

master

image

pr

image

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

I think this is exactly what we need :) 👍

unfortunately the exact code we use to filter this is going to completely change if we decide to move forward with #9910 (comment) :/

maybe we hold off on hardening this but we keep it open in draft to ensure the numbers don't change on us too much?

lighthouse-core/computed/page-dependency-graph.js Outdated Show resolved Hide resolved
@connorjclark
Copy link
Collaborator Author

Is this still relevant?

@vercel vercel bot temporarily deployed to Preview January 14, 2020 19:29 Inactive
@vercel vercel bot temporarily deployed to Preview January 14, 2020 19:30 Inactive
@vercel vercel bot temporarily deployed to Preview January 14, 2020 19:30 Inactive
"optimistic": 1307,
"pessimistic": 1307,
"timing": 1307,
"optimistic": 1337,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nice

@connorjclark
Copy link
Collaborator Author

meta note: it'd be nice if we saved a summary of test-lantern in a flat json file, and commit it to source. That way we can easily see from a git diff what the change is.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

a bummer that this accidentally hurts the basket sites slightly and doesn't fix any of those cases, but it's definitely more true to life and should fix #9627

LGTM % the weird node count thing being nothing

// Don't prune this node. The task is long so it will impact simulation.
// Don't prune if event is the first ParseHTML/Layout/Paint.
// See https://github.com/GoogleChrome/lighthouse/issues/9627#issuecomment-526699524 for more.
let isFirst = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let isFirst = false;
let isFirstOfImportantEventType = false;

maybe? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

does this really help with understanding? kinda a mouth full (mind full?) to read

Copy link
Collaborator

Choose a reason for hiding this comment

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

helps IMO, but I don't feel strongly can skip if you think it makes things worse

@@ -66,7 +66,7 @@ describe('FirstInteractive computed artifact:', () => {
pessimistic: Math.round(result.pessimisticEstimate.timeInMs),
}).toMatchSnapshot();
assert.equal(result.optimisticEstimate.nodeTimings.size, 19);
assert.equal(result.pessimisticEstimate.nodeTimings.size, 79);
assert.equal(result.pessimisticEstimate.nodeTimings.size, 80);
Copy link
Collaborator

@patrickhulce patrickhulce Jan 14, 2020

Choose a reason for hiding this comment

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

curious and very unexpected that the optimistic estimate already included this somehow but the pessimistic didn't...

can we double check this? might point to a bug we're both missing

Copy link
Collaborator Author

@connorjclark connorjclark Jan 15, 2020

Choose a reason for hiding this comment

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

is it b/c cpu idle uses fmp like this?

  static getEstimateFromSimulation(simulation, extras) {
    const fmpTimeInMs = extras.optimistic
      ? extras.fmpResult.optimisticEstimate.timeInMs
      : extras.fmpResult.pessimisticEstimate.timeInMs;

    return {
      timeInMs: LanternFirstCPUIdle.getFirstCPUIdleWindowStart(simulation.nodeTimings, fmpTimeInMs),
      nodeTimings: simulation.nodeTimings,
    };
  }

Copy link
Collaborator

Choose a reason for hiding this comment

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

That doesn't change the size of the nodeTimings map though, so I don't think it could affect this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No idea how to debug this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll take a look

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah it's not that the optimistic estimate already had it, it's just that it still gets filtered out by the optimistic estimate.

// Include everything that might be a long task
if (node.type === BaseNode.TYPES.CPU) {
return node.event.dur > minimumCpuTaskDuration;
}

This is slightly suboptimal but OKish from the simulation perspective because we're flooring on the first paint metrics if we end up too early and if it's that short it's unlikely to have a large impact to the last long task.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cool, thanks for looking!

@connorjclark connorjclark merged commit b02ef65 into master Jan 15, 2020
@connorjclark connorjclark deleted the lantern-keep-firsts branch January 15, 2020 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FCP may impact by the loadEvent fire or not in simulator throttling.
3 participants