Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Benchmarking VFP for string processing.
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00172131
Message ID:
00172285
Views:
26
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...

+++ Rick ---



>>>Along the same lines, the test where you pass the string by reference really doesn't apply either. What you're measuring there is both the mechanics connected with parameter passing and string manipulation. In general, passing strings by reference is always going to be more efficient than passing them by value, with the exception of 1-3 byte strings. You'll find that when passing strings by value, the length of time connected with passing the parameter is directly connected with the length of the string. When passing by reference, this doesn't come into play.
>>
>>
>>Oh but it does. If you change his example to:
>>
>>LPARAMETER lcString
>>RETURN lcString
>>
>>passing the value by value to be added - It's still way faster than the call by reference! Even doing:
>>
>>
>>LPARAMETER lcString
>>lcString = lcString + "aslkdjalsdjas"
>>RETURN lcString
>>
>>is still faster.
>>
>>The thing is that the ByRef call can't be optimized by the new string
>>functions, because it's a different variable. Passing values in and
>>out apparently is very fast (which seems strange, but that's how it
>>is).
>>
>Hi again Rick,
>
>After I first replied, I wondered if I were missing something. Perhaps I still am, and if so, I trust you'll clarify the above a bit. I read the above as saying that when passing by value, the length of the string doesn't come into play. Yet when I ran some tests, it apparently does. One of the things that I noted was that passing by value wasn't slower than passing by reference until the number of characters was greater than 8. Further, as the length of the string increased, so did the amount of time required to process the function call.
>
>Comments?
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform