Difference between revisions of "Parameter passing benchmark test"

From MidrangeWiki
Jump to: navigation, search
m (RESULTS: ok, this time actually sort the sections (-:)
 
(8 intermediate revisions by 3 users not shown)
Line 3: Line 3:
  
 
The results will be displayed on the terminal.
 
The results will be displayed on the terminal.
 +
To get a print of the results simply call the program from within QSHELL and redirect the output to a text file: /qsys.lib/yourlib.lib/valueconst.pgm > /home/yourdir/valueconst.txt
  
== The code ==
+
Original discussion thread from [[RPG400-L]] can be found at http://archive.midrange.com/rpg400-l/200710/msg00724.html
 +
<pre>
 +
Subject: Is const really that much better than value?
 +
From: "Larry Ducie" <Larry_Ducie@xxxxxxxxxxx>
 +
Date: Tue, 30 Oct 2007 22:16:37 +1000
 +
</pre>
 +
 
 +
== The Code ==
 
<code><pre>
 
<code><pre>
 
     H dftactgrp(*no) bnddir('QC2LE') option(*srcstmt)
 
     H dftactgrp(*no) bnddir('QC2LE') option(*srcstmt)
Line 24: Line 32:
 
     d byconstC        pr
 
     d byconstC        pr
 
     d bigparm                    65535a  const
 
     d bigparm                    65535a  const
 +
 +
    d byvalue2        pr
 +
    d bigparm                    32768a  varying value
 +
    d byconst2        pr
 +
    d bigparm                    32768a  varying const
 +
 +
    d byvalueC2      pr
 +
    d bigparm                    32768a  value
 +
    d byconstC2      pr
 +
    d bigparm                    32768a  const
  
 
     d printf          pr                  extproc('printf')
 
     d printf          pr                  extproc('printf')
Line 43: Line 61:
 
     d char100        s            100a  varying inz(*all'X')
 
     d char100        s            100a  varying inz(*all'X')
 
     d char1000        s          1000a  varying inz(*all'X')
 
     d char1000        s          1000a  varying inz(*all'X')
 +
    d char32768      s          32768a  varying inz(*all'X')
 
     d char65535      s          65535a  varying inz(*all'X')
 
     d char65535      s          65535a  varying inz(*all'X')
 
     d varyingField    s          65535a  varying
 
     d varyingField    s          65535a  varying
 +
    d varying2Field  s          32768a  varying
 
     d charField      s          65535a
 
     d charField      s          65535a
 +
    d char2Field      s          32768a
 
       /free
 
       /free
  
Line 61: Line 82:
  
 
           printf('----------------------------------------------' + crlf);
 
           printf('----------------------------------------------' + crlf);
           printf('Starting test...' + crlf);
+
           printf('---                                        ---' + crlf);
 +
          printf('---            Starting test             ---' + crlf);
 +
          printf('---                                        ---' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 
           printf('' + crlf);
 
           printf('' + crlf);
           printf('Testing with total ' + %char(ntimes) + ' calls' + crlf);
+
           printf('Testing with ' + %char(ntimes) + ' func calls ' + crlf);
 
           printf('Times given per ' + %char(percall) + ' calls' + crlf);
 
           printf('Times given per ' + %char(percall) + ' calls' + crlf);
 +
          printf('' + crlf);
 +
          printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
 +
          printf('Testing passing a 1a literal to 65535a parm' + crlf);
 +
          printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('Varying when passing a 1a literal' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 
           printf('' + crlf);
 
           printf('' + crlf);
  
Line 85: Line 117:
 
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
 
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
 
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('Varying where variable length is 65535' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('' + crlf);
  
 
           varyingField = char100;
 
           varyingField = char100;
Line 143: Line 181:
 
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
  
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('Fixed-length when passing a 1a literal' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('' + crlf);
  
 
           // For CHAR...
 
           // For CHAR...
Line 162: Line 205:
 
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
 
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
 
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('Fixed-length where variable length is 65535...' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('' + crlf);
  
 
           charField = char100;
 
           charField = char100;
Line 220: Line 269:
 
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
  
 +
          printf('' + crlf);
 +
          printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
 +
          printf('Testing passing 32768a variables to 65535 parm ' + crlf);
 +
          printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
 +
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('Varying where variable length is 32768...' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('' + crlf);
 +
 +
          varying2Field = char100;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalue (varying2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconst (varying2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 32768a varying with 100a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          varying2Field = char1000;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalue (varying2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconst (varying2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 32768a varying with 1000a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          varying2Field = char32768;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalue (varying2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconst (varying2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 32768a varying with 32768a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('Fixed-length where variable length is 32768a...' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('' + crlf);
 +
 +
          char2Field = char100;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalueC (char2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconstC (char2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 32768a with 100a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          char2Field = char1000;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalueC (char2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconstC (char2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 32768a with 1000a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          char2Field = char32768;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalueC (char2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconstC (char2Field);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 32768a with 32768a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          printf('' + crlf);
 +
          printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
 +
          printf('Testing passing 65535a variables to 32768 parm' + crlf);
 +
          printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('Varying where variable length is 65535' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('' + crlf);
 +
 +
          varyingField = char100;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalue2 (varyingField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconst2 (varyingField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 65535a varying with 100a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          varyingField = char1000;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalue2 (varyingField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconst2 (varyingField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 65535a varying with 1000a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          varyingField = char65535;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalue2 (varyingField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconst2 (varyingField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 65535a varying with 65535a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('Fixed-length where variable length is 65535...' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 +
          printf('' + crlf);
 +
 +
          charField = char100;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalueC2 (charField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconstC2 (charField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 65535a with 100a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          charField = char1000;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalueC2 (charField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconstC2 (charField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 65535a with 1000a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          charField = char65535;
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byvalueC2 (charField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t1 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          startTime = %timestamp();
 +
          for i = 1 to ntimes;
 +
            byconstC2 (charField);
 +
          endfor;
 +
          endTime = %timestamp();
 +
          t2 = (%diff(endTime : startTime : *ms)/group);
 +
 +
          printf('Passing a 65535a with 65535a filled...' + crlf);
 +
          printf('value: ' + %editc(t1 : 'P') + ' ms | '
 +
          + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);
 +
 +
          printf('' + crlf);
 +
          printf('----------------------------------------------' + crlf);
 
           printf('Test ended - press ENTER to close window...' + crlf);
 
           printf('Test ended - press ENTER to close window...' + crlf);
 
           printf('----------------------------------------------' + crlf);
 
           printf('----------------------------------------------' + crlf);
 
  
 
           // Read 1 char from the keyboard - to force display of screen...
 
           // Read 1 char from the keyboard - to force display of screen...
Line 249: Line 560:
 
     D bigParm                    65535a  const
 
     D bigParm                    65535a  const
 
     P byConstC        e
 
     P byConstC        e
 +
 +
    P byvalue2        b
 +
    D byValue2        pi
 +
    D bigParm                    32768a  varying value
 +
    P byValue2        e
 +
 +
    P byConst2        b
 +
    D byConst2        pi
 +
    D bigParm                    32768a  varying const
 +
    P byConst2        e
 +
 +
    P byvalueC2      b
 +
    D byValueC2      pi
 +
    D bigParm                    32768a  value
 +
    P byValueC2      e
 +
 +
    P byConstC2      b
 +
    D byConstC2      pi
 +
    D bigParm                    32768a  const
 +
    P byConstC2      e
 +
 
</pre></code>
 
</pre></code>
 
[[Category:RPG]]
 
  
 
== Results ==
 
== Results ==
Line 282: Line 612:
 
===V5R2 Model 270===
 
===V5R2 Model 270===
 
<pre>
 
<pre>
Times per 100 calls
+
Testing with 10000 func calls
 +
Times given per 100 calls
  
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
Testing passing a 1a literal to 65535a parm
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
----------------------------------------------
 +
Varying when passing a 1a literal
 +
----------------------------------------------
 
Passing the literal _a_ for 65535a varying...
 
Passing the literal _a_ for 65535a varying...
value:      152460 ms | const:        470 ms
+
value:      144050 ms | const:        380 ms
Passing a 65535a varying with 100a filled...  
+
----------------------------------------------
value:      145350 ms | const:        440 ms
+
Varying where variable length is 65535
 +
----------------------------------------------
 +
Passing a 65535a varying with 100a filled...
 +
value:      148220 ms | const:        320 ms
 +
Passing a 65535a varying with 1000a filled...
 +
value:      151680 ms | const:        330 ms
 +
Passing a 65535a varying with 65535a filled...
 +
value:      228070 ms | const:        330 ms
 +
----------------------------------------------
 +
Fixed-length when passing a 1a literal
 +
----------------------------------------------
 +
Passing the literal _a_ for 65535a...
 +
value:      178010 ms | const:      36730 ms
 +
----------------------------------------------
 +
Fixed-length where variable length is 65535...
 +
----------------------------------------------
 +
Passing a 65535a with 100a filled...
 +
value:      110360 ms | const:        320 ms
 +
Passing a 65535a with 1000a filled...
 +
value:      108050 ms | const:        310 ms
 +
Passing a 65535a with 65535a filled...
 +
value:      109060 ms | const:        310 ms
 +
 
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
Testing passing 32768a variables to 65535 parm
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
----------------------------------------------
 +
Varying where variable length is 32768...
 +
----------------------------------------------
 +
Passing a 32768a varying with 100a filled...
 +
value:      145410 ms | const:        330 ms
 +
Passing a 32768a varying with 1000a filled...
 +
value:      153400 ms | const:        330 ms
 +
Passing a 32768a varying with 32768a filled...
 +
value:      173940 ms | const:        330 ms
 +
----------------------------------------------
 +
Fixed-length where variable length is 32768a...
 +
----------------------------------------------
 +
Passing a 32768a with 100a filled...
 +
value:      189530 ms | const:      25840 ms
 +
Passing a 32768a with 1000a filled...
 +
value:      203750 ms | const:      25800 ms
 +
Passing a 32768a with 32768a filled...
 +
value:      199510 ms | const:      25740 ms
 +
 
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
Testing passing 65535a variables to 32768 parm
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
----------------------------------------------
 +
Varying where variable length is 65535
 +
----------------------------------------------
 +
Passing a 65535a varying with 100a filled...
 +
value:      72110 ms | const:        520 ms
 
Passing a 65535a varying with 1000a filled...
 
Passing a 65535a varying with 1000a filled...
value:     149180 ms | const:         340 ms
+
value:       47960 ms | const:       1080 ms
Passing a 65535a varying with 65535a filled..
+
Passing a 65535a varying with 65535a filled...
value:      224750 ms | const:         330 ms
+
value:      106030 ms | const:       17900 ms
Passing the literal _a_ for 65535a...      
+
----------------------------------------------
value:      188500 ms | const:      33620 ms
+
Fixed-length where variable length is 65535...
Passing a 65535a with 100a filled...        
+
----------------------------------------------
value:      96280 ms | const:        310 ms
+
Passing a 65535a with 100a filled...
Passing a 65535a with 1000a filled...      
+
value:      92730 ms | const:        310 ms
value:      96270 ms | const:        310 ms
+
Passing a 65535a with 1000a filled...
Passing a 65535a with 65535a filled...      
+
value:      67770 ms | const:        320 ms
value:      96370 ms | const:        310 ms
+
Passing a 65535a with 65535a filled...
 +
value:      88580 ms | const:        350 ms
 
</pre>
 
</pre>
  
Line 322: Line 712:
 
Passing a 65535a with 65535a filled...       
 
Passing a 65535a with 65535a filled...       
 
value:        246 ms | const:          1 ms
 
value:        246 ms | const:          1 ms
 +
</pre>
 +
 +
===V5R3 Model 520-7453===
 +
<pre>
 +
Testing with total 10000 calls               
 +
Times given per 100 calls                   
 +
                                             
 +
Passing the literal _a_ for 65535a varying...
 +
value:        5270 ms | const:          20 ms
 +
Passing a 65535a varying with 100a filled... 
 +
value:        5600 ms | const:          90 ms
 +
Passing a 65535a varying with 1000a filled...
 +
value:        5360 ms | const:          10 ms
 +
Passing a 65535a varying with 65535a filled...
 +
value:        7760 ms | const:          20 ms
 +
Passing the literal _a_ for 65535a...       
 +
value:        8120 ms | const:        1940 ms
 +
Passing a 65535a with 100a filled...         
 +
value:        5130 ms | const:          10 ms
 +
Passing a 65535a with 1000a filled...       
 +
value:        5140 ms | const:          20 ms
 +
Passing a 65535a with 65535a filled...       
 +
value:        5070 ms | const:          20 ms
 +
</pre>
 +
 +
===V5R3 Model 810-7409===
 +
<pre>
 +
Testing with total 10000 calls               
 +
Times given per 100 calls                   
 +
                                             
 +
Passing the literal _a_ for 65535a varying...
 +
value:      24510 ms | const:          40 ms
 +
Passing a 65535a varying with 100a filled... 
 +
value:      24900 ms | const:          40 ms
 +
Passing a 65535a varying with 1000a filled...
 +
value:      23830 ms | const:          60 ms
 +
Passing a 65535a varying with 65535a filled...
 +
value:      33800 ms | const:          40 ms
 +
Passing the literal _a_ for 65535a...       
 +
value:      40760 ms | const:        4760 ms
 +
Passing a 65535a with 100a filled...         
 +
value:      17030 ms | const:          40 ms
 +
Passing a 65535a with 1000a filled...       
 +
value:      17360 ms | const:          30 ms
 +
Passing a 65535a with 65535a filled...       
 +
value:      15920 ms | const:          40 ms
 
</pre>
 
</pre>
  
Line 367: Line 803:
 
value:        120 ms | const:          1 ms
 
value:        120 ms | const:          1 ms
 
</pre>
 
</pre>
 +
 +
 +
===V5R4 Model 270 2432 LPAR 80% processor===
 +
<pre>
 +
Testing with 10000 func calls                 
 +
Times given per 100 calls                     
 +
++++++++++++++++++++++++++++++++++++++++++++++ 
 +
Testing passing a 1a literal to 65535a parm   
 +
++++++++++++++++++++++++++++++++++++++++++++++ 
 +
---------------------------------------------- 
 +
Varying when passing a 1a literal             
 +
---------------------------------------------- 
 +
Passing the literal _a_ for 65535a varying... 
 +
value:      19080 ms | const:          40 ms 
 +
---------------------------------------------- 
 +
Varying where variable length is 65535         
 +
---------------------------------------------- 
 +
Passing a 65535a varying with 100a filled...   
 +
value:      20290 ms | const:          50 ms
 +
Passing a 65535a varying with 1000a filled...
 +
value:      23410 ms | const:          60 ms
 +
Passing a 65535a varying with 65535a filled...
 +
value:      28430 ms | const:          60 ms
 +
----------------------------------------------
 +
Fixed-length when passing a 1a literal       
 +
----------------------------------------------
 +
Passing the literal _a_ for 65535a...       
 +
value:      27770 ms | const:        5050 ms
 +
----------------------------------------------
 +
Fixed-length where variable length is 65535...
 +
----------------------------------------------
 +
Passing a 65535a with 100a filled...         
 +
value:      11900 ms | const:          40 ms
 +
Passing a 65535a with 1000a filled...       
 +
value:      11740 ms | const:          30 ms
 +
Passing a 65535a with 65535a filled...       
 +
value:      11450 ms | const:          30 ms
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
Testing passing 32768a variables to 65535 parm
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
----------------------------------------------
 +
Varying where variable length is 32768...   
 +
----------------------------------------------
 +
Passing a 32768a varying with 100a filled... 
 +
value:      18920 ms | const:          60 ms
 +
Passing a 32768a varying with 1000a filled...
 +
value:      21480 ms | const:          30 ms
 +
Passing a 32768a varying with 32768a filled...
 +
value:      27420 ms | const:          60 ms
 +
----------------------------------------------
 +
Fixed-length where variable length is 32768a..
 +
----------------------------------------------
 +
Passing a 32768a with 100a filled...         
 +
value:      28100 ms | const:        3430 ms
 +
Passing a 32768a with 1000a filled...       
 +
value:      27290 ms | const:        3450 ms
 +
Passing a 32768a with 32768a filled...       
 +
value:      28800 ms | const:        3430 ms 
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
Testing passing 65535a variables to 32768 parm
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
----------------------------------------------
 +
Varying where variable length is 65535       
 +
----------------------------------------------
 +
Passing a 65535a varying with 100a filled... 
 +
value:      10550 ms | const:          60 ms 
 +
Passing a 65535a varying with 1000a filled... 
 +
value:        7070 ms | const:        130 ms 
 +
Passing a 65535a varying with 65535a filled...
 +
value:      15170 ms | const:        2180 ms 
 +
----------------------------------------------
 +
Fixed-length where variable length is 65535...
 +
----------------------------------------------
 +
Passing a 65535a with 100a filled...         
 +
value:      11940 ms | const:          50 ms 
 +
Passing a 65535a with 1000a filled...         
 +
value:        9800 ms | const:          40 ms 
 +
Passing a 65535a with 65535a filled...       
 +
value:      11670 ms | const:          60 ms 
 +
</pre>
 +
 +
 +
 +
===V5R3 Model 270 2432 LPAR 20% processor===
 +
<pre>
 +
Testing with 10000 func calls                   
 +
Times given per 100 calls                       
 +
++++++++++++++++++++++++++++++++++++++++++++++ 
 +
Testing passing a 1a literal to 65535a parm     
 +
++++++++++++++++++++++++++++++++++++++++++++++ 
 +
---------------------------------------------- 
 +
Varying when passing a 1a literal               
 +
---------------------------------------------- 
 +
Passing the literal _a_ for 65535a varying...   
 +
value:      78450 ms | const:        130 ms   
 +
---------------------------------------------- 
 +
Varying where variable length is 65535         
 +
---------------------------------------------- 
 +
Passing a 65535a varying with 100a filled...   
 +
value:      80010 ms | const:        200 ms 
 +
Passing a 65535a varying with 1000a filled... 
 +
value:      84110 ms | const:        200 ms 
 +
Passing a 65535a varying with 65535a filled...
 +
value:      125380 ms | const:        200 ms 
 +
----------------------------------------------
 +
Fixed-length when passing a 1a literal       
 +
----------------------------------------------
 +
Passing the literal _a_ for 65535a...         
 +
value:      128000 ms | const:      20610 ms 
 +
----------------------------------------------
 +
Fixed-length where variable length is 65535...
 +
----------------------------------------------
 +
Passing a 65535a with 100a filled...         
 +
value:      66700 ms | const:        200 ms 
 +
Passing a 65535a with 1000a filled...         
 +
value:      65600 ms | const:        200 ms 
 +
Passing a 65535a with 65535a filled...       
 +
value:      65790 ms | const:        190 ms 
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
Testing passing 32768a variables to 65535 parm
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
----------------------------------------------
 +
Varying where variable length is 32768...     
 +
----------------------------------------------
 +
Passing a 32768a varying with 100a filled... 
 +
value:      85210 ms | const:        200 ms 
 +
Passing a 32768a varying with 1000a filled... 
 +
value:      87900 ms | const:        200 ms 
 +
Passing a 32768a varying with 32768a filled...
 +
value:      118800 ms | const:        200 ms 
 +
----------------------------------------------
 +
Fixed-length where variable length is 32768a...
 +
----------------------------------------------
 +
Passing a 32768a with 100a filled...         
 +
value:      114720 ms | const:      15700 ms 
 +
Passing a 32768a with 1000a filled...         
 +
value:      112610 ms | const:      16200 ms 
 +
Passing a 32768a with 32768a filled...       
 +
value:      118210 ms | const:      16290 ms 
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
Testing passing 65535a variables to 32768 parm
 +
++++++++++++++++++++++++++++++++++++++++++++++
 +
----------------------------------------------
 +
Varying where variable length is 65535       
 +
----------------------------------------------
 +
Passing a 65535a varying with 100a filled... 
 +
value:      42620 ms | const:        380 ms 
 +
Passing a 65535a varying with 1000a filled... 
 +
value:      30500 ms | const:        770 ms 
 +
Passing a 65535a varying with 65535a filled...
 +
value:      71120 ms | const:      11010 ms 
 +
----------------------------------------------
 +
Fixed-length where variable length is 65535...
 +
----------------------------------------------
 +
Passing a 65535a with 100a filled...         
 +
value:      53090 ms | const:        200 ms 
 +
Passing a 65535a with 1000a filled...         
 +
value:      44700 ms | const:        190 ms 
 +
Passing a 65535a with 65535a filled...         
 +
value:      53610 ms | const:        130 ms 
 +
</pre>
 +
 +
==Categories==
 +
[[Category:Benchmarks]]
 +
[[Category:RPG]]

Latest revision as of 23:39, 6 November 2007

The Test

This test program is designed to benchmark the passing of large character data to a subprocedure. To call this program simply call it from a command line. The program will perform each check and print out the average call times per 100 calls for each check. There are 2 optional parameters. The first parameter will instruct the program to perform that number of calls for each test. The second parameter will instruct the program to print the call time as the average time taken to perform that number of calls. The default for the two parameters is 10,000 and 100. That is, the program will call each subprocedure 10,000 times and give the average time taken to call each subprocedure 100 times.

The results will be displayed on the terminal. To get a print of the results simply call the program from within QSHELL and redirect the output to a text file: /qsys.lib/yourlib.lib/valueconst.pgm > /home/yourdir/valueconst.txt

Original discussion thread from RPG400-L can be found at http://archive.midrange.com/rpg400-l/200710/msg00724.html

Subject: Is const really that much better than value?
From: "Larry Ducie" <Larry_Ducie@xxxxxxxxxxx>
Date: Tue, 30 Oct 2007 22:16:37 +1000

The Code

     H dftactgrp(*no) bnddir('QC2LE') option(*srcstmt)

     d valueconst      pr                  extpgm('VALUECONST')
     d p_ntimes                      15p 5 const
     d p_percall                     15p 5 const
     d valueconst      pi
     d p_ntimes                      15p 5 const
     d p_percall                     15p 5 const

     d byvalue         pr
     d bigparm                    65535a   varying value
     d byconst         pr
     d bigparm                    65535a   varying const

     d byvalueC        pr
     d bigparm                    65535a   value
     d byconstC        pr
     d bigparm                    65535a   const

     d byvalue2        pr
     d bigparm                    32768a   varying value
     d byconst2        pr
     d bigparm                    32768a   varying const

     d byvalueC2       pr
     d bigparm                    32768a   value
     d byconstC2       pr
     d bigparm                    32768a   const

     d printf          pr                  extproc('printf')
     d                                 *   value options(*string)

     d getchar         pr            10i 0 extproc('getchar')

     d ntimes          s             10i 0 inz(10000)
     d percall         s             10i 0 inz(100)
     d group           s             10i 0 inz(0)

     d startTime       s               z
     d endTime         s               z
     d t1              s             10i 0
     d t2              s             10i 0
     d msg             s             52a
     d i               s             10i 0
     d crlf            c                   const(X'0d25')
     d char100         s            100a   varying inz(*all'X')
     d char1000        s           1000a   varying inz(*all'X')
     d char32768       s          32768a   varying inz(*all'X')
     d char65535       s          65535a   varying inz(*all'X')
     d varyingField    s          65535a   varying
     d varying2Field   s          32768a   varying
     d charField       s          65535a
     d char2Field      s          32768a
      /free

           // Override number of calls to make to each function...
           if %parms >= 1;
             ntimes = p_ntimes;
           endif;

           // Override number of calls to group over...
           if %parms >= 2;
             percall = p_percall;
           endif;

           group = ntimes/percall;

           printf('----------------------------------------------' + crlf);
           printf('---                                        ---' + crlf);
           printf('---             Starting test              ---' + crlf);
           printf('---                                        ---' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);
           printf('Testing with ' + %char(ntimes) + ' func calls ' + crlf);
           printf('Times given per ' + %char(percall) + ' calls' + crlf);
           printf('' + crlf);
           printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
           printf('Testing passing a 1a literal to 65535a parm' + crlf);
           printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Varying when passing a 1a literal' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);

           // For VARYING...
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue ('a');
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst ('a');
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing the literal _a_ for 65535a varying...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Varying where variable length is 65535' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);

           varyingField = char100;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue (varyingField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst (varyingField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a varying with 100a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           varyingField = char1000;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue (varyingField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst (varyingField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a varying with 1000a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           varyingField = char65535;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue (varyingField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst (varyingField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a varying with 65535a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Fixed-length when passing a 1a literal' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);

           // For CHAR...
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC ('a');
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC ('a');
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing the literal _a_ for 65535a...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Fixed-length where variable length is 65535...' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);

           charField = char100;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC (charField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC (charField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a with 100a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           charField = char1000;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC (charField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC (charField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a with 1000a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           charField = char65535;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC (charField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC (charField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a with 65535a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           printf('' + crlf);
           printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
           printf('Testing passing 32768a variables to 65535 parm ' + crlf);
           printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);

           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Varying where variable length is 32768...' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);

           varying2Field = char100;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue (varying2Field);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst (varying2Field);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 32768a varying with 100a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           varying2Field = char1000;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue (varying2Field);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst (varying2Field);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 32768a varying with 1000a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           varying2Field = char32768;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue (varying2Field);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst (varying2Field);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 32768a varying with 32768a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Fixed-length where variable length is 32768a...' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);

           char2Field = char100;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC (char2Field);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC (char2Field);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 32768a with 100a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           char2Field = char1000;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC (char2Field);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC (char2Field);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 32768a with 1000a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           char2Field = char32768;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC (char2Field);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC (char2Field);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 32768a with 32768a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           printf('' + crlf);
           printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
           printf('Testing passing 65535a variables to 32768 parm' + crlf);
           printf('++++++++++++++++++++++++++++++++++++++++++++++' + crlf);
           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Varying where variable length is 65535' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);

           varyingField = char100;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue2 (varyingField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst2 (varyingField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a varying with 100a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           varyingField = char1000;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue2 (varyingField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst2 (varyingField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a varying with 1000a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           varyingField = char65535;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalue2 (varyingField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconst2 (varyingField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a varying with 65535a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Fixed-length where variable length is 65535...' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('' + crlf);

           charField = char100;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC2 (charField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC2 (charField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a with 100a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           charField = char1000;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC2 (charField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC2 (charField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a with 1000a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           charField = char65535;
           startTime = %timestamp();
           for i = 1 to ntimes;
             byvalueC2 (charField);
           endfor;
           endTime = %timestamp();
           t1 = (%diff(endTime : startTime : *ms)/group);

           startTime = %timestamp();
           for i = 1 to ntimes;
             byconstC2 (charField);
           endfor;
           endTime = %timestamp();
           t2 = (%diff(endTime : startTime : *ms)/group);

           printf('Passing a 65535a with 65535a filled...' + crlf);
           printf('value: ' + %editc(t1 : 'P') + ' ms | '
           + 'const: ' + %editc(t2 : 'P') + ' ms' + crlf);

           printf('' + crlf);
           printf('----------------------------------------------' + crlf);
           printf('Test ended - press ENTER to close window...' + crlf);
           printf('----------------------------------------------' + crlf);

           // Read 1 char from the keyboard - to force display of screen...
           i = getchar();

           *inlr = *on;
       /end-free

     P byvalue         b
     D byValue         pi
     D bigParm                    65535a   varying value
     P byValue         e

     P byConst         b
     D byConst         pi
     D bigParm                    65535a   varying const
     P byConst         e

     P byvalueC        b
     D byValueC        pi
     D bigParm                    65535a   value
     P byValueC        e

     P byConstC        b
     D byConstC        pi
     D bigParm                    65535a   const
     P byConstC        e

     P byvalue2        b
     D byValue2        pi
     D bigParm                    32768a   varying value
     P byValue2        e

     P byConst2        b
     D byConst2        pi
     D bigParm                    32768a   varying const
     P byConst2        e

     P byvalueC2       b
     D byValueC2       pi
     D bigParm                    32768a   value
     P byValueC2       e

     P byConstC2       b
     D byConstC2       pi
     D bigParm                    32768a   const
     P byConstC2       e

Results

The results so far are:

(If you wish to include the timings for your machine it is recommended that you call the program with no parameters. This will ensure all benchmark tests will be easily compared (10,000 calls per subprocedure, and time per 100 calls printed)

V5R2 Model 170-2290

Times per 1 call

Passing the literal _a_ for 65535a varying...
value:        3339 ms | const:          24 ms
Passing a 65535a varying with 100a filled... 
value:        3314 ms | const:          21 ms
Passing a 65535a varying with 1000a filled...
value:        3367 ms | const:          21 ms
Passing a 65535a varying with 65535a filled...
value:        4572 ms | const:          21 ms
Passing the literal _a_ for 65535a...        
value:        4579 ms | const:        1087 ms
Passing a 65535a with 100a filled...         
value:        2483 ms | const:          21 ms
Passing a 65535a with 1000a filled...        
value:        2844 ms | const:          23 ms
Passing a 65535a with 65535a filled...       
value:        2503 ms | const:          22 ms

V5R2 Model 270

Testing with 10000 func calls 
Times given per 100 calls

++++++++++++++++++++++++++++++++++++++++++++++
Testing passing a 1a literal to 65535a parm
++++++++++++++++++++++++++++++++++++++++++++++
----------------------------------------------
Varying when passing a 1a literal
----------------------------------------------
Passing the literal _a_ for 65535a varying...
value:      144050 ms | const:         380 ms
----------------------------------------------
Varying where variable length is 65535
----------------------------------------------
Passing a 65535a varying with 100a filled...
value:      148220 ms | const:         320 ms
Passing a 65535a varying with 1000a filled...
value:      151680 ms | const:         330 ms
Passing a 65535a varying with 65535a filled...
value:      228070 ms | const:         330 ms
----------------------------------------------
Fixed-length when passing a 1a literal
----------------------------------------------
Passing the literal _a_ for 65535a...
value:      178010 ms | const:       36730 ms
----------------------------------------------
Fixed-length where variable length is 65535...
----------------------------------------------
Passing a 65535a with 100a filled...
value:      110360 ms | const:         320 ms
Passing a 65535a with 1000a filled...
value:      108050 ms | const:         310 ms
Passing a 65535a with 65535a filled...
value:      109060 ms | const:         310 ms

++++++++++++++++++++++++++++++++++++++++++++++
Testing passing 32768a variables to 65535 parm 
++++++++++++++++++++++++++++++++++++++++++++++
----------------------------------------------
Varying where variable length is 32768...
----------------------------------------------
Passing a 32768a varying with 100a filled...
value:      145410 ms | const:         330 ms
Passing a 32768a varying with 1000a filled...
value:      153400 ms | const:         330 ms
Passing a 32768a varying with 32768a filled...
value:      173940 ms | const:         330 ms
----------------------------------------------
Fixed-length where variable length is 32768a...
----------------------------------------------
Passing a 32768a with 100a filled...
value:      189530 ms | const:       25840 ms
Passing a 32768a with 1000a filled...
value:      203750 ms | const:       25800 ms
Passing a 32768a with 32768a filled...
value:      199510 ms | const:       25740 ms

++++++++++++++++++++++++++++++++++++++++++++++
Testing passing 65535a variables to 32768 parm
++++++++++++++++++++++++++++++++++++++++++++++
----------------------------------------------
Varying where variable length is 65535
----------------------------------------------
Passing a 65535a varying with 100a filled...
value:       72110 ms | const:         520 ms
Passing a 65535a varying with 1000a filled...
value:       47960 ms | const:        1080 ms
Passing a 65535a varying with 65535a filled...
value:      106030 ms | const:       17900 ms
----------------------------------------------
Fixed-length where variable length is 65535...
----------------------------------------------
Passing a 65535a with 100a filled...
value:       92730 ms | const:         310 ms
Passing a 65535a with 1000a filled...
value:       67770 ms | const:         320 ms
Passing a 65535a with 65535a filled...
value:       88580 ms | const:         350 ms

V5R2 Model SB1-2313

Times per 1 call

Passing the literal _a_ for 65535a varying...
value:         318 ms | const:           2 ms
Passing a 65535a varying with 100a filled... 
value:         301 ms | const:           1 ms
Passing a 65535a varying with 1000a filled...
value:         339 ms | const:           1 ms
Passing a 65535a varying with 65535a filled...
value:         439 ms | const:           1 ms
Passing the literal _a_ for 65535a...        
value:         570 ms | const:          95 ms
Passing a 65535a with 100a filled...         
value:         246 ms | const:           1 ms
Passing a 65535a with 1000a filled...        
value:         276 ms | const:           1 ms
Passing a 65535a with 65535a filled...       
value:         246 ms | const:           1 ms

V5R3 Model 520-7453

Testing with total 10000 calls                
Times given per 100 calls                     
                                              
Passing the literal _a_ for 65535a varying... 
value:        5270 ms | const:          20 ms 
Passing a 65535a varying with 100a filled...  
value:        5600 ms | const:          90 ms 
Passing a 65535a varying with 1000a filled... 
value:        5360 ms | const:          10 ms 
Passing a 65535a varying with 65535a filled...
value:        7760 ms | const:          20 ms 
Passing the literal _a_ for 65535a...         
value:        8120 ms | const:        1940 ms 
Passing a 65535a with 100a filled...          
value:        5130 ms | const:          10 ms 
Passing a 65535a with 1000a filled...         
value:        5140 ms | const:          20 ms 
Passing a 65535a with 65535a filled...        
value:        5070 ms | const:          20 ms 

V5R3 Model 810-7409

Testing with total 10000 calls                
Times given per 100 calls                     
                                              
Passing the literal _a_ for 65535a varying... 
value:       24510 ms | const:          40 ms 
Passing a 65535a varying with 100a filled...  
value:       24900 ms | const:          40 ms 
Passing a 65535a varying with 1000a filled... 
value:       23830 ms | const:          60 ms 
Passing a 65535a varying with 65535a filled...
value:       33800 ms | const:          40 ms 
Passing the literal _a_ for 65535a...         
value:       40760 ms | const:        4760 ms 
Passing a 65535a with 100a filled...          
value:       17030 ms | const:          40 ms 
Passing a 65535a with 1000a filled...         
value:       17360 ms | const:          30 ms 
Passing a 65535a with 65535a filled...        
value:       15920 ms | const:          40 ms 

V5R3 Model 890

Times per 1 call

Passing the literal _a_ for 65535a varying...        
value:         120 ms | const:           0 ms        
Passing a 65535a varying with 100a filled...         
value:          60 ms | const:           0 ms        
Passing a 65535a varying with 1000a filled...        
value:          50 ms | const:           0 ms        
Passing a 65535a varying with 65535a filled...       
value:          90 ms | const:           0 ms        
Passing the literal _a_ for 65535a...                
value:         180 ms | const:          30 ms        
Passing a 65535a with 100a filled...                 
value:          60 ms | const:           0 ms        
Passing a 65535a with 1000a filled...                
value:          60 ms | const:           0 ms  
Passing a 65535a with 65535a filled...         
value:          60 ms | const:           0 ms

V5R4 Model 520

Times per 1 call

Passing the literal _a_ for 65535a varying...
value:         133 ms | const:           6 ms
Passing a 65535a varying with 100a filled... 
value:         150 ms | const:           1 ms
Passing a 65535a varying with 1000a filled...
value:         131 ms | const:           6 ms
Passing a 65535a varying with 65535a filled..
value:         201 ms | const:           1 ms
Passing the literal _a_ for 65535a...        
value:         207 ms | const:          41 ms
Passing a 65535a with 100a filled...         
value:         127 ms | const:           1 ms
Passing a 65535a with 1000a filled...        
value:         122 ms | const:           7 ms
Passing a 65535a with 65535a filled...       
value:         120 ms | const:           1 ms


V5R4 Model 270 2432 LPAR 80% processor

Testing with 10000 func calls                   
Times given per 100 calls                       
++++++++++++++++++++++++++++++++++++++++++++++  
Testing passing a 1a literal to 65535a parm     
++++++++++++++++++++++++++++++++++++++++++++++  
----------------------------------------------  
Varying when passing a 1a literal               
----------------------------------------------  
Passing the literal _a_ for 65535a varying...   
value:       19080 ms | const:          40 ms   
----------------------------------------------  
Varying where variable length is 65535          
----------------------------------------------  
Passing a 65535a varying with 100a filled...    
value:       20290 ms | const:          50 ms 
Passing a 65535a varying with 1000a filled... 
value:       23410 ms | const:          60 ms 
Passing a 65535a varying with 65535a filled...
value:       28430 ms | const:          60 ms 
----------------------------------------------
Fixed-length when passing a 1a literal        
----------------------------------------------
Passing the literal _a_ for 65535a...         
value:       27770 ms | const:        5050 ms 
----------------------------------------------
Fixed-length where variable length is 65535...
----------------------------------------------
Passing a 65535a with 100a filled...          
value:       11900 ms | const:          40 ms 
Passing a 65535a with 1000a filled...         
value:       11740 ms | const:          30 ms 
Passing a 65535a with 65535a filled...        
value:       11450 ms | const:          30 ms 
++++++++++++++++++++++++++++++++++++++++++++++
Testing passing 32768a variables to 65535 parm
++++++++++++++++++++++++++++++++++++++++++++++
----------------------------------------------
Varying where variable length is 32768...     
----------------------------------------------
Passing a 32768a varying with 100a filled...  
value:       18920 ms | const:          60 ms 
Passing a 32768a varying with 1000a filled... 
value:       21480 ms | const:          30 ms 
Passing a 32768a varying with 32768a filled...
value:       27420 ms | const:          60 ms 
----------------------------------------------
Fixed-length where variable length is 32768a..
----------------------------------------------
Passing a 32768a with 100a filled...          
value:       28100 ms | const:        3430 ms 
Passing a 32768a with 1000a filled...         
value:       27290 ms | const:        3450 ms 
Passing a 32768a with 32768a filled...         
value:       28800 ms | const:        3430 ms  
++++++++++++++++++++++++++++++++++++++++++++++ 
Testing passing 65535a variables to 32768 parm 
++++++++++++++++++++++++++++++++++++++++++++++ 
---------------------------------------------- 
Varying where variable length is 65535         
---------------------------------------------- 
Passing a 65535a varying with 100a filled...   
value:       10550 ms | const:          60 ms  
Passing a 65535a varying with 1000a filled...  
value:        7070 ms | const:         130 ms  
Passing a 65535a varying with 65535a filled... 
value:       15170 ms | const:        2180 ms  
---------------------------------------------- 
Fixed-length where variable length is 65535... 
---------------------------------------------- 
Passing a 65535a with 100a filled...           
value:       11940 ms | const:          50 ms  
Passing a 65535a with 1000a filled...          
value:        9800 ms | const:          40 ms  
Passing a 65535a with 65535a filled...         
value:       11670 ms | const:          60 ms  


V5R3 Model 270 2432 LPAR 20% processor

Testing with 10000 func calls                    
Times given per 100 calls                        
++++++++++++++++++++++++++++++++++++++++++++++   
Testing passing a 1a literal to 65535a parm      
++++++++++++++++++++++++++++++++++++++++++++++   
----------------------------------------------   
Varying when passing a 1a literal                
----------------------------------------------   
Passing the literal _a_ for 65535a varying...    
value:       78450 ms | const:         130 ms    
----------------------------------------------   
Varying where variable length is 65535           
----------------------------------------------   
Passing a 65535a varying with 100a filled...     
value:       80010 ms | const:         200 ms  
Passing a 65535a varying with 1000a filled...  
value:       84110 ms | const:         200 ms  
Passing a 65535a varying with 65535a filled... 
value:      125380 ms | const:         200 ms  
---------------------------------------------- 
Fixed-length when passing a 1a literal         
---------------------------------------------- 
Passing the literal _a_ for 65535a...          
value:      128000 ms | const:       20610 ms  
---------------------------------------------- 
Fixed-length where variable length is 65535... 
---------------------------------------------- 
Passing a 65535a with 100a filled...           
value:       66700 ms | const:         200 ms  
Passing a 65535a with 1000a filled...          
value:       65600 ms | const:         200 ms  
Passing a 65535a with 65535a filled...         
value:       65790 ms | const:         190 ms  
++++++++++++++++++++++++++++++++++++++++++++++ 
Testing passing 32768a variables to 65535 parm 
++++++++++++++++++++++++++++++++++++++++++++++ 
---------------------------------------------- 
Varying where variable length is 32768...      
---------------------------------------------- 
Passing a 32768a varying with 100a filled...   
value:       85210 ms | const:         200 ms  
Passing a 32768a varying with 1000a filled...  
value:       87900 ms | const:         200 ms  
Passing a 32768a varying with 32768a filled... 
value:      118800 ms | const:         200 ms  
---------------------------------------------- 
Fixed-length where variable length is 32768a...
---------------------------------------------- 
Passing a 32768a with 100a filled...           
value:      114720 ms | const:       15700 ms  
Passing a 32768a with 1000a filled...          
value:      112610 ms | const:       16200 ms  
Passing a 32768a with 32768a filled...         
value:      118210 ms | const:       16290 ms  
++++++++++++++++++++++++++++++++++++++++++++++ 
Testing passing 65535a variables to 32768 parm 
++++++++++++++++++++++++++++++++++++++++++++++ 
---------------------------------------------- 
Varying where variable length is 65535         
---------------------------------------------- 
Passing a 65535a varying with 100a filled...   
value:       42620 ms | const:         380 ms  
Passing a 65535a varying with 1000a filled...  
value:       30500 ms | const:         770 ms  
Passing a 65535a varying with 65535a filled... 
value:       71120 ms | const:       11010 ms  
---------------------------------------------- 
Fixed-length where variable length is 65535... 
---------------------------------------------- 
Passing a 65535a with 100a filled...           
value:       53090 ms | const:         200 ms  
Passing a 65535a with 1000a filled...           
value:       44700 ms | const:         190 ms   
Passing a 65535a with 65535a filled...          
value:       53610 ms | const:         130 ms   

Categories