[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: more info - performance with local procedures...



Clark,

> I welcome any additional evidence that either supports or debunks this
> theory.  please attache code and results in postings - either here or
> directly to me.

I think of it this way.  A local procedure is the same as a global
procedure in there is a MOVE for each parameter _before_ the call,
and a MOVE for each output parameter _after_ the call.  Therefore,
we would expect a "local" procedure to behave the same as a "global"
assuming we're not passing parameters (or doing assignments before
and after the routine).

Here are the timings I got for 1,000,000 calls to a procedure
(global, local, or param) and the program I used to get these
timings.  Basically, the issue is not whether it's a global
or local procedure, but whether or not you pass parameters
to it (or do the equivalent MOVEs).

       Elaspsed       CPU
global   22.258    10.950
local    22.211    10.970
param    35.186    17.290
noparam  34.209    16.530

My program follows:

begin-program
do main
end-program

begin-procedure main
move 'asdf' to $global_1
move 'qwer' to $global_2
move '' to $global_3
move 0 to #i
while #i < 1000000

   #debuga do global_procedure

   #debugb do local_procedure

   #debugc do param_procedure( $global_1 , $global_2 , $global_3 )

   #debugd move $global_1 to $p1
   #debugd move $global_2 to $p2
   #debugd move $global_3 to $p3
   #debugd do no_param_procedure
   #debugd move $p3 to $global_3

   add 1 to #i
end-while
end-procedure

begin-procedure global_procedure
let $global_3 = $global_1 || $global_2
end-procedure

begin-procedure local_procedure local
let $_global_3 = $_global_1 || $_global_2
end-procedure

begin-procedure param_procedure( $p1 , $p2 , :$p3 )
let $p3 = $p1 || $p2
end-procedure

begin-procedure no_param_procedure
let $p3 = $p1 || $p2
end-procedure

----------------------------------------------------------------------
Ray Ontko       |  Ray Ontko & Co  |  "RO&C: data movers and shakers."
rayo@ontko.com  |  Richmond, In    |  See us at http://www.ontko.com/