[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Move Versus Let discussion
Here are the results from the test I ran on our production box, Ultra Sparc
6000, 10 CPU... Note the reletively wide variation in times for each test,
I attribute this to the fact that this server is a production server with
several Sybase servers running and other misc apps running at the same time.
Each line item is the USER time from the UNIX time utility, might it have
been better to use the REAL time? I ran the 3 sqr's using Solaris 2.5.1
(ksh), SQR 3.0.12.3.
T0 T1 T2
3.10 7.84 4.57
3.10 8.06 9.13
6.47 3.76 4.59
3.11 3.78 4.57
3.10 3.79 4.60
3.14 4.43 4.58
6.40 8.25 4.58
3.13 7.82 4.55
6.41 8.16 4.54
3.09 8.17 4.55
4.11 6.41 5.03
T1 - T0 = 2.30
T2 - T0 = 0.92
These results are opposite Ray's... Not sure why, any ideas?
Steve
At 02:59 PM 9/8/97 -0500, you wrote:
>In the ongoing discussion about MOVE and LET:
>
>I ran 3 little programs on our Pentium 100 running Linux. We're using
>SQR/3.0.15.
>
>t0.sqr runs an empty loop 1,000,000 times.
>t1.sqr does MOVE 0 TO #dummy 1,000,000 times.
>t2.sqr does LET #dummy = 0 1,000,000 times.
>
>Here are the timings (user time from "time" utility)
>for five trials in seconds:
>
> t0 t1 t2
> ---- ---- ----
> 5.16 6.02 6.70
> 5.10 6.18 6.68
> 5.06 6.03 6.69
> 5.09 6.06 6.70
> 5.11 6.02 6.73
> ---- ---- ----
>avg 5.10 6.06 6.70
>
>Subtracting out the time for the overhead of running the loop (t0),
>we get 6.06 - 5.10 = 0.96 sec for 1,000,000 MOVEs to a numeric,
>and 6.70 - 5.10 = 1.60 sec for 1,000,000 LETs to a numeric.
>
>We might reasonably conclude that for simple numeric assignments,
>LET is 1.67 times as expensive as MOVE (on my box).
>
>Lots more can be investigated:
> How do these perform on other boxes?
> How do MOVE and LET compare for string assignments?
> What about ADD/SUBTRACT/MULTIPLY/DIVIDE?
> What about CONCAT/EXTRACT/FIND vs. ||/SUBSTR/INSTRING?
> What about UPPERCASE/LOWERCASE vs. upper/lower?
> What about ARRAY-ADD?
>
>Here are the programs I used. One obvious improvement is
>to do 10 MOVES/LETS per loop instead of just one. This
>would increase the ratio of MOVE/LET to overhead.
>
>t0.sqr:
>
>begin-program
>do main
>end-program
>
>begin-procedure main
>move 0 to #count
>while #count < 1000000
> add 1 to #count
>end-while
>end-procedure ! main
>
>t1.sqr:
>
>begin-program
>do main
>end-program
>
>begin-procedure main
>move 0 to #count
>while #count < 1000000
> move 0 to #dummy
> add 1 to #count
>end-while
>end-procedure ! main
>
>t2.sqr:
>
>begin-program
>do main
>end-program
>
>begin-procedure main
>move 0 to #count
>while #count < 1000000
> let #dummy = 0
> add 1 to #count
>end-while
>end-procedure ! main
>
>----------------------------------------------------------------------
>Ray Ontko | Ray Ontko & Co | "Time for a new signature line."
>rayo@ontko.com | Richmond, In | See us at http://www.ontko.com/
>