Measure time needed within workers (profiling)

Hello, in order to improve the performance of our software, we would like to gather metrics for specific processes ran in our worker. Since workers use a different handling for the time / date value (spectre protection as far as i remember), we can't simply use functions like performance.now(). I learned from a thread i started in #analytics (https://discord.com/channels/595317990191398933/1115387663982276648/1131126277215092778) time is updated on async operations. We would like to gather the time needed for execution of query-resolvers on graphql as well as rendering of specific react components on SSR. Analytics-Engine seems to be the best match for gathering. Any functions im not aware of, which could be used for measuring time-needed?
1 Reply
kian
kian17mo ago
There isn’t really any good timing methods available in Workers Date/Performance.now() are all you have, or you can make a sub request to an external timing source which would probably take 20-40ms
Want results from more Discord servers?
Add your server