I have been playing with text stuff recently. I was posted a warning regarding Replace String and the fact that it takes - forever - to do large replacement counts in large texts. 500,000 replaces in 4,800,000 characters was something like 30 minutes.
I found a "Fix". It is easy, it is simple, and it results in better then 650x improvement in speed, and it should not hurt if used in a version where the 4D has rewritten the replace string code. (which is where? which version?) This code, on my poor old 2010 mini does the above replacement (511,535 tabs, in a 4,800,000 character text) in... 2.7 SECS !!! the Size I determined by trial and error. smaller numbers, increase execution time larger numbers increase execution time. I did not do single value increments, but 23500 was longer 22500 was longer here it is (no comments but it should be obvious what is happening): C_TEXT($1;$Source;$Replace;$2;$New_Text;$0;$Temp_Text) C_LONGINT($i;$Size;$Segments) $Source:=$1 $Replace:=$2 $Size:=23000 //empirically determined $Segments:=Int(Length($Source)/$Size)+1 For ($I;1;$Segments) $Temp_Text:=Substring($Source;($Size*($i-1));$size) $Temp_Text:=Replace string($Temp_Text;$Replace;"";*) $New_Text:=$New_Text+$Temp_Text End for $0:=$New_Text --------------- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ********************************************************************** 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] **********************************************************************

