1821802 Members
3298 Online
109637 Solutions
New Discussion юеВ

timex

 
Deepak Extross
Honored Contributor

timex

Hi,
I was investigating the use of an alternative algorithm for a certain task. I'm not going to mention either the task or the algo, for fear of biasing the gentle reader's mind :-)
I have found that Method-2 offers a significant saving in User Time and System Time, but the Real (User) Time is the more-or-less the same, as you can see from the attachment.
If I change over to Method-2, will the users see any reduction is processing time? Can I jump out of my bathtub crying Eureka?
2 REPLIES 2
David Lodge
Trusted Contributor

Re: timex

In theory Real time should be the one to use; but as this depends on system performance and workload at the time the program is run, then it may be skewed.

The best way to run this is to do multiple iteration, and either time all iterations or work out an average; something like:

$ cat iterate
i=0
while (( i < 1000 ))
do
exec ${@}
(( i = i - 1 ))
done
$
$ timex iterate old-program
$ timex iterate new-program

And see the differences over this period

dave
Steven Gillard_2
Honored Contributor

Re: timex

Is there IO involved? Method 2 is obviously saving a bit of CPU time but if there's disk IO involved then that may be whats taking up most of the 'real' time.

Regards,
Steve