-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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(tracehouse): split timeOrigin determination out of computeTraceOfTab #11253
Conversation
maybe we should start a glossary :)
etc... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i only have nits
Co-authored-by: Connor Clark <[email protected]>
🦗 🦗 🦗 |
@adamraine would you mind taking a look at this? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😬 😳
is needed for FR work now
How is firstResourceSendRequest
going to be used in FR? It seems like it would have a number of possible issues for anything but a 'navigation'
It's not. This refactor to eliminate automatic selection of time origin based on navigation is required, i.e. "split timeOrigin determination out of computeTraceOfTab" ;) |
Co-authored-by: Brendan Kenny <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some last questions but regardless of the answers this LGTM2 and is ready to land
}); | ||
|
||
// Ensure our traceEnd reflects all page activity. | ||
const traceEnd = this.computeTraceEnd(trace.traceEvents, timeOriginEvt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason not to just pass trace.traceEvents
into computeKeyTimingsForFrame
and do traceEnd
for real in there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in pass both frameEvents and all trace events?
Primary reason I did not do that is it violates the veil of abstraction that computeKeyTimingsForFrame
well, computes the key timings for a frame :)
If the double computation is problematic I'd prefer to modify the return type of computeKeyTimingsForFrame
to omit traceEnd
entirely as a proper fix. The duplication of all the types to avoid a double computation didn't seem to be worth the tradeoff in confusion initially since the trace end computation is cheap (~0.5ms/MB of trace). Prefer this approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the double computation is problematic
It's not fatally problematic, no more so than breaking the veil :) And definitely not worried about the computation cost. I was just curious about your thinking on which was less confusing, passing in both sets of events or fake computing it and then doing it for real. Breaking the type down might be worse but it's possible it would be ok...e.g. with an inferred return type on computeKeyTimingsForFrame
, maybe?
I'm also trying to be more literal in my review comments. I was 95% sure you had already considered this question so I was 95% really just asking, and 5% suggesting considering it and then just asking as a consideration follow up :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking the type down might be worse but it's possible it would be ok...e.g. with an inferred return type on computeKeyTimingsForFrame, maybe?
I like it SG!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the double computation is problematic I'd prefer to modify the return type of computeKeyTimingsForFrame to omit traceEnd entirely as a proper fix.
Just noticed FrameTimings
is a new typedef, and yeah, this would be the proper fix and it would be great if it's a simple modification to the Omit
, but I don't know if there's an easy way to do that one level deep, so don't worry about it if there's not.
@@ -19,6 +19,15 @@ class LHTraceProcessor extends TraceProcessor { | |||
return new LHError(LHError.errors.NO_NAVSTART); | |||
} | |||
|
|||
/** | |||
* This isn't ever actually used, but might one day be. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol if this is true (and there aren't concrete FR plans for it), why are we refactoring and adding 'firstResourceSendRequest'
? Why not refactor but have 'lastNavigationStart'
be the only option right now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, looking at the excellent comment on computeTimeOrigin
, maybe the simpler thing is to change this to something more concrete like
* This isn't ever actually used, but might one day be. | |
* This isn't currently used, but will be when the time origin of trace processing is changed. | |
* @see {TraceProcessor.computeTimeOrigin} |
(the @see
doesn't actually work like for that yet, but will soon(!), though if the thing isn't imported, I don't know if you actually have to do something like @see {import('../../path/to/trace-processor.js').computeTimeOrigin}
or what)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we [...] adding 'firstResourceSendRequest'?
firstResourceSendRequest won't be used for FR, but will be used for the #8984 line of work that will continue amidst FR.
Why not refactor but have 'lastNavigationStart' be the only option right now?
That's another option but a motivating example to validate the split seemed worthwhile to pair with the refactor given its simplicity and test uninterestingness if there's only one option :)
maybe the simpler thing is to change this to something more concrete like
sg 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, two real things, sorry :)
lighthouse-core/lib/lh-error.js
Outdated
@@ -242,6 +242,11 @@ const ERRORS = { | |||
message: UIStrings.badTraceRecording, | |||
lhrRuntimeError: true, | |||
}, | |||
NO_RESOURCE_SEND: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NO_FIRST_RESOURCE
? NO_FIRST_RESOURCE_SEND
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be added to the proto, too, since it's a lhrRuntimeError
? Again it's a bit premature, but we might easily forget to do it when the error is live.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be added to the proto, too, since it's a lhrRuntimeError? Again it's a bit premature, but we might easily forget to do it when the error is live.
Yeah sg might as well do it now too.
re: NO_FIRST_RESOURCE_SEND
, any particular reason you'd like to see the addition of FIRST
? It seemed like unnecessarily specific information to add to me that might lead to narrower usage later. The only way there can be no first resource request is if there were none at all :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re:
NO_FIRST_RESOURCE_SEND
, any particular reason you'd like to see the addition ofFIRST
? It seemed like unnecessarily specific information to add to me that might lead to narrower usage later. The only way there can be no first resource request is if there were none at all :)
it's just short and I was wondering if there's more context we can give it. That's a very good point, though :)
"Resource send" is kind of confusing as representing the request for a resource, though (ResourceSendRequest
does make sense with the other trace event names next to it). Maybe NO_RESOURCE_REQUEST
? A slight step away from the trace event name but slightly more understandable on its own.
I'll stop bikeshedding after this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NO_RESOURCE_REQUEST
sold :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still LGTM :)
}); | ||
|
||
// Ensure our traceEnd reflects all page activity. | ||
const traceEnd = this.computeTraceEnd(trace.traceEvents, timeOriginEvt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the double computation is problematic I'd prefer to modify the return type of computeKeyTimingsForFrame to omit traceEnd entirely as a proper fix.
Just noticed FrameTimings
is a new typedef, and yeah, this would be the proper fix and it would be great if it's a simple modification to the Omit
, but I don't know if there's an easy way to do that one level deep, so don't worry about it if there's not.
Summary
Another noop tracehouse change that
will make it easier for fraggle rock and tracehouse consumers in the futureis needed for FR work now. This PR splits apart thecomputeTraceOfTab
method into a few components.It has one user-facing impact which is a minor bug fix to our
traceEnd
computation. Previously we did not consider the maximumts + dur
time so it changes by a few ms in some situations.Related Issues/PRs
ref #8984 #10325 #9519