With time measurements keep in mind:
- usually, you are not alone on a Cache server
There are many other processes, some of them belongs to Cache other to the OS
- the time resolution (whatever you use: $now(), $zh) is also limited
- it depends also on the time, how long your mesurement runs (you are not alone!)
This is my short testroutine:
Times(iter=1E3,count=4) ; show times
w ?3,"count num+1 1+num =$i() $i()",!
w ?15,"times in microseconds",!
w $tr($j("",40)," ",-1),!
f i=1:1:count d time(iter) s iter=iter*10
q
time(iter)
{
s f=1E6/iter // factor for "one operation in microseconds"
w $j(iter,8)
s num=0,t=$zh f i=1:1:iter { s num=num+1 } d t($zh-t*f)
s num=0,t=$zh f i=1:1:iter { s num=1+num } d t($zh-t*f)
s num=0,t=$zh f i=1:1:iter { s num=$i(num) } d t($zh-t*f)
s num=0,t=$zh f i=1:1:iter { i $i(num) } d t($zh-t*f)
w !
}
t(t)
{
w $j(t,8,3)
}
and this is the output
USER>d ^Times(1,8) count num+1 1+num =$i() $i() times in microseconds ---------------------------------------- 1 2.000 1.000 2.000 1.000 10 0.100 0.100 0.100 0.200 100 0.030 0.030 0.080 0.080 1000 0.044 0.042 0.088 0.090 10000 0.028 0.028 0.075 0.077 100000 0.027 0.027 0.064 0.050 1000000 0.018 0.014 0.031 0.032 10000000 0.011 0.011 0.031 0.032 USER>d ^Times(1,8) count num+1 1+num =$i() $i() times in microseconds ---------------------------------------- 1 4.000 0.000 2.000 1.000 10 0.100 0.100 0.100 0.100 100 0.040 0.030 0.080 0.580 1000 0.044 0.041 0.088 0.088 10000 0.028 0.028 0.075 0.077 100000 0.027 0.027 0.073 0.076 1000000 0.027 0.021 0.032 0.032 10000000 0.011 0.011 0.031 0.032 USER>d ^Times(1,8) count num+1 1+num =$i() $i() times in microseconds ---------------------------------------- 1 3.000 1.000 2.000 1.000 10 0.100 0.000 0.100 0.100 100 0.040 0.030 0.080 0.590 1000 0.045 0.041 0.088 0.090 10000 0.028 0.028 0.075 0.077 100000 0.027 0.027 0.073 0.075 1000000 0.015 0.012 0.031 0.032 10000000 0.011 0.011 0.031 0.032 USER> USER> USER>d ^Times(1,8) count num+1 1+num =$i() $i() times in microseconds ---------------------------------------- 1 3.000 0.000 3.000 1.000 10 0.100 0.000 0.100 0.100 100 0.030 0.030 0.080 0.630 1000 0.046 0.042 0.088 0.090 10000 0.028 0.028 0.075 0.077 100000 0.027 0.027 0.073 0.075 1000000 0.014 0.012 0.032 0.032 10000000 0.011 0.011 0.031 0.032 USER>
I consider time measurements only as a rough approximations
- Log in to post comments