Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

99
Views
Is it possible to use a high resolution timer from within an iframe for benchmarking absolute performance against the parent document?

I am trying to benchmark the performance implications of various iframe setups.

I would like to know how long it takes from the start of the root document until a certain point within an iframe.

One option is to use Date.now() and compare that to the host's performance.timeOrigin of the root page like so:

<body>
   <iframe> <!-- cross origin iframe -->
     <script>console.log(Date.now())</script>
   </iframe>
   <script>console.log(performance.timeOrigin)</script>
</body>

The issue is that Date.now() offers inaccurate times and I would rather use a high resolution timer offered by the performance API.

Trying to use performance.now() gives me a relative duration since the start of the current frame, however I am trying to obtain the relative duration since the start of the rootmost document.

So if you imagine something like this:

<body>
   <iframe>
     <script>console.log(performance.now())</script> // 8ms
   </iframe>
   <script>console.log(performance.now())</script> // 30ms
</body>

There does not appear to be a way to get a high resolution absolute time using the performance API. Any ideas?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!