Hi Arnaud,

First of all, it seems we have reverse definition of Diacritical. To avoid 
confusion, let's use (*) to represent the operation.

I'm interested how you could count execution in "given time". In this time, we 
execute 100,000 times of position(*) in 14ms and Replace String(*) to replace 
100,000 occurance of same length of replacement string in 16ms.

In your test, you got 684 execution of position in 180 ticks (3 seconds). In my 
test, I got 100,000 execution of position in less than 1 tick. Even with 
replace string(*), it replaced 100,000 occurence of string of same length in 
16ms (just under 1
tick which is 16.67ms). Due to high overhead of your testing code, it might 
compromise the result.

OK. I have confessed that I tested only 13.6 (not 16) since I don't want to 
install 16 on my development machine. However, based on 4D, Replace String(*) 
in v16 perform as fast as v13.6 if the replacement string is of same length 
(very fast indeed -
100,000 replacement in 16ms). For replacement of string of longer length, v16 
will do "pre-scan" number of occurance and create an appropriate block of 
memory for the result. It means, it should be taking a little more time than 
replacement string
of same length.

My test code in ES_Count

C_LONGINT($0;$c;$start;$pos;$len)
C_TEXT($1;$2;$source;$find)
$c:=0
$source:=$1
$find:=$2
$len:=Length($find)
$start:=1
If ((Length($source)>0) & ($len>0))
Repeat 
$pos:=Position($find;$source;$start;*) 
If ($pos>0)
$start:=$pos+$len
$c:=$c+1
End if 
Until ($pos=0)
End if 
$0:=$c

Alan Chan

4D iNug Technical <[email protected]> writes:
>since v15R3, using 'Replace string' for count seems always faster to me than 
>'Position' - even if [compiled+strict comparison] it's quite the same. Could 
>be a detail, but instead of measuring time to loop $i times, I often prefer to 
>count how much
>iterations are executed during a given time, it makes interpreted/compiled 
>switch easier. All results under are from compiled, all 32b versions except 
>v16 in 64b. 
><https://screencast.com/t/9TXxsJUH8ooj>
>The little v12 test base I've used is here:
><http://forums.4d.fr/Post//15925184/1/#15925185>

**********************************************************************
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