On 2/8/2013 3:13 PM, RPGLIST wrote:
I was recently reading that a static procedure call is faster than a
typical program CALL.
I know that with procedures you can pass more data (Parms if you will)
than you can with a typcial program CALL, but are locally or externally
defined procedures really that faster than program CALLS?
CALLP is about 35 times faster than CALL on my machine. Details below.
I wrote several programs and a service program to run some benchmarks.
First, I tested CALL to see if calling a program named in a variable is
different to calling a program named in a constant, ie CALL PGM vs CALL
'PGMNAME'. It does 100k loops of a CALL opcode. The callee does
nothing except RETURN. All times in microseconds. Power 720 8202-E4C
one core activated, 7.1, latest cume, during business hours. I signed
off before each trial.
Caller and callee running in the same AG
LR on, variable: 239000
LR on, constant: 222000
LR off, variable: 229000
LR off, constant: 211000
Caller in a named AG and callee in different, named AG:
LR on, variable: 243000
LR on, constant: 223000
LR off, variable: 227000
LR off, constant: 210000
Caller in a named AG and callee in DAG:
LR on, variable: 1891000
LR on, constant: 1865000
LR off, variable: 213000
LR off, constant: 199000
Callee in *NEW:
LR on, variable: 130064000
LR on, constant: 130567000
LR off, variable: 131184000
LR off, constant: 130365000
CALLP of a subprocedure which does nothing except RETURN:
*CALLER: 7000
Different named AG: 7000
Caller and callee in DAG: 7000
Callee is internal: 6000
Quick analysis:
1) A CALLP is about 35 times faster than a CALL.
2) There is no appreciable difference between putting the called program
name in a variable vs using a constant.
3) LR on / off only matters if the callee is in the default activation
group.
4) On my machine it takes roughly 1300 microseconds to create a new
activation group.
5) ILE calling into the DAG is about 8 times slower than calling into
ILE with LR on. The difference is cut to even parity with LR off.
7) There is no appreciable difference between a subprocedure called out
of a service program and a subprocedure defined in the calling program
--buck
As an Amazon Associate we earn from qualifying purchases.