> Le 22 avr. 2017 à 13:16, Bruno LEGAY via 4D_Tech <[email protected]> a 
> écrit :
> 
> I haven't measured if EXECUTE METHOD has a significant overhead to be 
> honest...

it depends  ;-)

+++
ARRAY LONGINT($ms_al;2)
C_LONGINT($count_l;$duration_l;$tk_l)
$duration_l:=60*3

  //**loop 1**
$tk_l:=Tickcount+$duration_l
$count_l:=0
Repeat  
        $count_l:=$count_l+1
        $result:=TestMethod (...)
Until (Tickcount>=$tk_l)
$ms_al{1}:=$count_l

  //**loop 2**
$tk_l:=Tickcount+$duration_l
$count_l:=0
Repeat  
        $count_l:=$count_l+1
        EXECUTE METHOD("TestMethod";$result;...)
Until (Tickcount>=$tk_l)
$ms_al{2}:=$count_l

C_REAL($ratio_r)
$ratio_r:=$ms_al{1}/$ms_al{2}
ALERT(String($ms_al{1})+"\r"+String($ms_al{2})+"\r"+String($ratio_r))
+++

I tried with 3 different 'TestMethod'
  a - a simple wrapper of 'Random' function
  b - a home made random based on generate UUID + hexadecimal convert
  c - explode a delimited text in a text array 
Just to mention that from a to c, the called TestMethod is more and more time 
consuming (in other words, regarding $count_l, a > b > c). 

• interpreted 
no difference, loop 1 & 2 are executed the same number of times. 

• compiled 
  a - loop 1 executed 88 times more than loop 2
  b - loop 1 executed 3 times more than loop 2
  c - loop 1 ~ loop 2

In conclusion, the more time consuming the called method, the most negligible 
EXECUTE METHOD. 

-- 
Arnaud de Montard 



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to