Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WITH object
Message
From
16/11/2019 03:33:02
Walter Meester
HoogkarspelNetherlands
 
 
To
15/11/2019 20:49:10
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01671871
Message ID:
01671905
Views:
47
>>>By the way, the 33% gain exists on every call.
>
>I believe I saw WITH performance benefits confirmed by another Rick (Rick Schummer) many years ago in a discussion that I think also involved Doug Hennig, to the effect that WITH is useful in sequences of 3 or more property accesses or method calls. If you're saying there's a benefit with even one access, that I did not know.

If you carefully look at Ricks H example, he has not demonstrated that. Its referencing the property 5 Million times within one single WITH statement.
In fact the difference in performance between accessing a property or method through WITH or object reference is miniscule and it probably needs hundreds of accesses before it breaks even with the cost of the WITH statement itself (Rick H's example did execute this only once for many millions of iterations).

The example is misleading as the extra cost in the object reference test is due to passing the object to the function and in itself has nothing to do with the performance gains WITH (fails) to give you. Its the elimination of having to pass an object to the function which makes the difference. If you would perform the calculations directly in the FOR NEXT loop you'd see that WITH actually does not buy you more than a few percent over millions of iterations in a single WITH construct.

I've not followed that discussion between Hennig and Schummer I believe, but I suspect it has to do with with deep object references or COM object references, which then becomes an entire different matter.
Previous
Reply
Map
View

Click here to load this message in the networking platform