>I don't think this is an issue of which is faster, but which
>can take advantage of the new VFP string optimization features.
>I think if you just compare by val and by ref you'll find that
>in general by ref will be faster, but only marginally so even
>for large strings.
>
>The key is to figure out how to get the function that's
>called to optimize the string output it's returning.
>
>I don't know at this point - I'll have to run some more tests
>to see exactly where the benefit comes from, but when I tested
>this yesterday there's no doubt that passing by reference
>and adding text to the string is way slower than doing the
>same thing by value. It doesn't make sense to me either, but
>that's what the test came up with...
>
Hi Rick,
Got some very interesting results from a test I ran over the weeked. Using a function that merely passed the parameter back to the caller, I used it to concatenate strings ranging from 1 to 100 characters passing the parameter by both reference and value. I used 10,000 iterations for each in order to get a measure of the amount of time the calls took. Ran the sequence 10 times and saved the information into a table.
Basically, the results showed very little difference (max 0.12 seconds over 10,000 iterations). The interesting things (I thought) were: Reference was always faster than value. The amount of time value took "spiked" (had an abnormal jump) between 8 and 9 character strings. The biggest surprise was that the amount of time it took to pass by reference rose in proportion to the length of the string. This was totally unexpected. I don't have any explanation. VFP memory handling maybe? What do you think?
George
Ubi caritas et amor, deus ibi est