Walter Meester
HoogkarspelNetherlands
General information
Category:
Coding, syntax & commands
>>>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only