How to measure Firefox’s startup time

benchmarkfirefoxtime

I would like to measure how much time it takes for some softwares to start.

I know the command time but in the case of firefox (iceweasel for me on Debian), this command prints only the time I let firefox open. If I launch:

$ time iceweasel www.google.com

I will have a startup time only after I closed firefox and this time will only indicate how long I left firefox opened. For example:

real    0m50.565s
user    0m4.276s
sys 0m0.248s

How can I know exactly how much firefox need to start?

Best Answer

This is hacky and unscriptable.

Firefox can run javascript via command line like so:

firefox "javascript:alert(Date.now())"

That will open Firefox and run javascript that pops up a message box containing the current epoch time to the millisecond.

You can get the number of milliseconds elapsed in epoch time at your command line with

date +%s%N | cut -b1-13

So to answer your question, run

date +%s%N | cut -b1-13; iceweasel "javascript:alert(Date.now())"

Then subtract the number in your terminal from the number in Firefox. This gives you the number of milliseconds Firefox took to open and display some basic javascript.

Sources:

Related Question