chyoo CHENG
chyoo CHENG

Reputation: 720

How to Measure a script's running time when run it many times

I hava a node.js scrpit and I want to measure it's running time. But when I run it like this:

time node xxx.js

It just give the time of running once. If I want to measure 10000 times's running time, how do i do it?

It just like %timeit in ipython.

Upvotes: 0

Views: 25

Answers (1)

choroba
choroba

Reputation: 241858

Just time a loop:

time for i in {1..10000} ; do node xxx.js ; done

Note that it measures node's startup time, too.

Upvotes: 1

Related Questions