From: Chip Davis <chip@av...>  20070529 23:25:49

Okay, I'm quite sure I don't understand something going on here. Out of curiosity, I added a 'spammer_e' routine to use Parse instead of Substr() but I got such anomalous results that I began to question the metrics Rony was reporting. Finally, I simply modified his 'spammer_a' routine to append the fixed value of a variable instead of the next letter of the string: ::routine spammer_x parse arg string, rep s='*' do rep Newstring = left(string,1) Do I = 2 to length(string) Newstring = newstring'<Z>'s truncated substr() into a var End end return newstring Here are the run times I got, pretty consistently: C:\Chip\bin>spammer run # 1, string length: 16 spammer_x: 0.030000 (No SUBSTRBIF) spammer_a: 0.030000 (SUBSTRBIF) spammer_b: 0.020000 (INSERTBIF) spammer_c: 0.041000 (MutableBuffer: append) spammer_d: 0.020000 (MutableBuffer: insert) s0: W<Z>*<Z>*< ... >*<Z>*<Z>* length: 61 s1: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 61 s2: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 61 s3: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 61 s4: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 61  run # 2, string length: 160 spammer_x: 1.392000 (No SUBSTRBIF) spammer_a: 0.650000 (SUBSTRBIF) spammer_b: 0.281000 (INSERTBIF) spammer_c: 0.350000 (MutableBuffer: append) spammer_d: 0.261000 (MutableBuffer: insert) s0: W<Z>*<Z>*< ... >*<Z>*<Z>* length: 637 s1: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 637 s2: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 637 s3: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 637 s4: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 637  run # 3, string length: 1600 spammer_x: 12.838000 (No SUBSTRBIF) spammer_a: 10.916000 (SUBSTRBIF) spammer_b: 14.280000 (INSERTBIF) spammer_c: 3.475000 (MutableBuffer: append) spammer_d: 7.251000 (MutableBuffer: insert) s0: W<Z>*<Z>*< ... >*<Z>*<Z>* length: 6397 s1: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 6397 s2: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 6397 s3: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 6397 s4: W<Z>h<Z>a< ... >a<Z>y<Z>. length: 6397  run # 4, string length: 16000 ... [Got tired of waiting] Can anyone tell me how the hell a simple variable reference can take longer than a call to Substr() AND a variable reference? I'm not sure I trust Time() to give me an accurate measure of elapsed time anymore... Chip On 5/29/07 10:37 Rony G. Flatscher said: > > Here are the timings of the attached little program. 