denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.46k stars 5.38k forks source link

Adding Resource Timing API #7829

Open yiss opened 4 years ago

yiss commented 4 years ago

Deno has support for User Timing API, but I couldn't find reference to Resource Timing API https://w3c.github.io/resource-timing. Is there I would like to help implementing this if it doesn't exist already

kitsonk commented 4 years ago

This would take some designing, as a lot of what is standard in a browser as resource timings is not applicable to Deno. What specifically are you suggesting on implementing?

In particular, having the information about fetch() would be interesting and useful, but it gets a bit more complicated since we moved fetch to an op_create. @bartlomieju thoughts?

yiss commented 4 years ago

Hi @kitsonk , Thank you for your reply. For my use case I'm using Deno to perform some performance tests. What I'm interested in particular is XMLHttpRequest phase and to be precise (TCP handshake (connectStart and connectEnd), and response (responseStart and responseEnd). This example also calculates the time from the start of the fetch and request start phases (fetchStart and requestStart, respectively), until the response has ended (responseEnd).

yiss commented 4 years ago

I think we can make something like for https://github.com/denoland/deno/pull/6421

kitsonk commented 4 years ago

Deno doesn't have a XMLHttpRequest. If you are using it to instrument other code, then as you point out, it would just be a matter of using the user timing APIs.