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: Use onload handlers to create dependencies for trace events #4600

Open
patrickhulce opened this issue Feb 21, 2018 · 7 comments
Open

Comments

@patrickhulce
Copy link
Collaborator

When an image has an lengthy onload handler decode, we can connect that long task to the loading of the image. This would help with smoke testing our byte efficiency audits when using Lantern-based estimates too.

Brief investigation for onload:

  • The parent event fired has event.args.src_func: 'ImageNotifyFinished'
  • The first child event has event.args.data.type: 'load', event.name: 'EventDispatch'

there's no URL unfortunately but we can probably connect it to an image resource based on timestamp

@patrickhulce patrickhulce changed the title Lantern: Use onload handlers to create dependencies of trace events Lantern: Use onload handlers to create dependencies for trace events Feb 21, 2018
@paulirish
Copy link
Member

@patrickhulce i wonder if this is fixed by #5504 ?

@patrickhulce
Copy link
Collaborator Author

Yeah good call I suspect it might be

@connorjclark
Copy link
Collaborator

@patrickhulce i wonder if this is fixed by #5504 ?

this being the entire issue here, or just "there's no URL unfortunately but we can probably connect it to an image resource based on timestamp" ?

@patrickhulce
Copy link
Collaborator Author

I suspect just the

"there's no URL unfortunately but we can probably connect it to an image resource based on timestamp" ?

part would be fixed by async stacks, but I have not looked into it.

@patrickhulce
Copy link
Collaborator Author

This is actually super important for LCP metric accuracy. I'll look into it 👍

@patrickhulce patrickhulce added P1.5 and removed P2 labels Sep 17, 2020
@patrickhulce patrickhulce self-assigned this Sep 17, 2020
@patrickhulce
Copy link
Collaborator Author

This is still fairly difficult :/

Even with our async stacks and sampling profiler all we get to link it to an image URL is the "Finish Loading" event, well before the task, and a "PaintImage" event in a raster thread.

Maybe we can link it all together with...

  • An EventDispatch event with args.data.type = "load"
  • that followed a ResourceFinish of an image
  • that had a PaintImage event within the task

The problem I imagine is going to be when lots of images finish at the same time it's going to be really difficult (impossible?) to identify which was which :/

@patrickhulce
Copy link
Collaborator Author

Alright a bit more investigation and it is not possible with current information available in trace events to identify exactly which load event was being dispatched. We would need to add the network request ID, image URL, or some other identifier to the EventDispatch event in order to make this happen.

View Example Test Page
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
</head>
<body>
  <script>
    function stall(ms = 50) {
      const start = Date.now()
      while (Date.now() - start < ms) ;
    }
  </script>
  <img src="https://picsum.photos/id/237/400/400" onload="stall(2500)">
  <img src="https://picsum.photos/id/236/200/200" onload="stall(250)">
  <img src="https://picsum.photos/id/235/200/200" onload="stall(250)">
  <img src="https://picsum.photos/id/234/200/200" onload="stall(250)">
  <img src="https://picsum.photos/id/233/200/200" onload="stall(250)">
  <img src="https://picsum.photos/id/232/200/200" onload="stall(250)">
  <img src="https://picsum.photos/id/231/200/200" onload="stall(250)">

  
  <p>some other content</p>
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants