You're running only substring and your modifiedSubstring. A piece of code 
segment cannot tell much how you use substring and your modifiedSubstring.

For your information, using blob should be able to take less than 2 seconds in 
compiled.

Alan Chan

4D iNug Technical <[email protected]> writes:
>ok - doing some testing and recoding.
>I do not quite understand....
>
>I wrote code to implement substring (see far below)
>I use it in a parsing routine (see below) on a text block of 2.7 
>million characters.
>time to process the entire block : 36.5 sec.
>
>I use the exact same code, using 4D's Substring command
>Time to process the entire block : 129.8 sec.
>
>Why is the (presumably) compiled C code SLOWER, then Interpreted 4D 
>code?
>by a factor of 4?
>
>
>---------
>Parsing Routine
>(initialization code removed)
>For ($i;1;$How_Many)
>$Start_Loc:=l_Last_Position+1
>$Found_Location:=utl_text_Position ($Find;$Source;$Start_Loc)
>
>If ($Found_Location>0)  //found
>l_Last_Position:=$Find_Length+$Found_Location-1
>Else 
>$i:=utl_Exit_Loop 
>End if 
>End for 
>
>If ($i=MAXLONG)  //not found. or not found enough
>$Return_Text:=utl_text_Faster_Substring ($Source;$Start_Loc)
>Else   //found requested occurence count of Find
>$Return_Text:=utl_text_Faster_Substring($Source;$Start_Loc;$Found_Location-1)
>End if 
>$0:=$Return_Text


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