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(preconnect): use lantern to compute savings #5070

Merged
merged 3 commits into from
May 1, 2018

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Apr 30, 2018

blocked on #5071

Relatively simple change, approximates the savings using just the TCP handshake time from lantern. The simulator itself doesn't have a notion of preconnect, so we won't estimate savings on a particular metric and bringing in the whole graph isn't necessary.

@@ -2894,27 +2894,27 @@
{
"url": "http://localhost:10200/dobetterweb/dbw_tester.css?delay=100",
"totalBytes": 821,
"wastedMs": 873
"wastedMs": 330
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 clue why these changed I'm looking into it...

@patrickhulce patrickhulce changed the base branch from master to fix_simulator_origin April 30, 2018 19:37
@patrickhulce patrickhulce changed the base branch from fix_simulator_origin to master April 30, 2018 20:24
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.

LGTM! (with nits)

// DNS time can be large but can also be 0 if a commonly used origin that's cached, so make
// no assumption about DNS.
const additionalRtt = additionalRttByOrigin.get(securityOrigin) || 0;
let connectionTime = rtt + additionalRtt;
Copy link
Member

Choose a reason for hiding this comment

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

is rtt not number | undefined? (based on LH.Gatherer.Simulation.Options, at least)

Copy link
Member

Choose a reason for hiding this comment

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

oh, the file isn't type checked yet :) It would be good to handle it now, though

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed on the simulator side 👍

@@ -17,7 +17,6 @@ declare global {
url: string;
_url: string;
protocol: string;
origin: string | null;
Copy link
Member

Choose a reason for hiding this comment

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

I know this was from the last PR, but should we put a warning on origin to not use it? like

/** use `parsedURL.securityOrigin()` instead */
origin: never;

or something. It could probably sneak back in in the future otherwise (just a comment might also work :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah good call done

// no assumption about DNS.
const additionalRtt = additionalRttByOrigin.get(securityOrigin) || 0;
let connectionTime = rtt + additionalRtt;
if (firstRecordOfOrigin.parsedURL.scheme === 'https') connectionTime = connectionTime * 2;
Copy link
Member

Choose a reason for hiding this comment

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

comment on where the *2 comes from (is that the TLS mentioned above? Why *2?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@patrickhulce patrickhulce merged commit 2803c0c into master May 1, 2018
@patrickhulce patrickhulce deleted the lantern_preconnect_opp branch May 1, 2018 16:35
@paulirish paulirish mentioned this pull request May 1, 2018
82 tasks
kdzwinel pushed a commit to kdzwinel/lighthouse that referenced this pull request Aug 16, 2018
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.

2 participants