• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

144
Views
Is there a way to time script download time separately from execution?

I'd like to instrument some timing variables for my main JavaScript load. I could do something like this:

<script>
  performance.mark('script-start')
</script>
<script src="something.js"></script>

Then somewhere in something.js add a performance.measure('script-start').

The problem is that this would time both the script download time and the script parsing and (part of) the execution time. Is there a way to time script download and execution separately?

about 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Put performance.measure('script-start') at the very beginning of something.js. This will include the parse time, but not the execution time. Unless the script is enormous, the parse time should be almost negligible.

You could time the download and execution separately by putting performance.mark('download-start') in the first <script> tag. Then put

performance.measure('download-end');
performance.start('script-start');

at the beginning of something.js.

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

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error