* Results on my machine: * Parameter -- 33.049 seconds * Implicit WITH -- 21.240 seconds * Demonstrates a performance boost by not passing in the parameter, and referencing the contextual WITH environment PUBLIC gnTot CLEAR lo = CREATEOBJECT("thetest") lo.test() * test1() receives an input parameter FUNCTION test1 LPARAMETERS toObj gnTot = gnTot + toObj.val * test2() receives an implicit environment with a contextual WITH in scope FUNCTION test2 gnTot = gnTot + .val DEFINE CLASS thetest AS Custom val = 5 PROCEDURE test LOCAL lnI, lfStart1, lfEnd1, lfStart2, lfEnd2 * Pass by parameter gnTot = 0 lfStart1 = SECONDS() FOR lnI = 1 TO 10000000 test1(this) test1(this) test1(this) test1(this) test1(this) NEXT lfEnd1 = SECONDS() ? "Result passing by parameter", gnTot * No parameter pass, using WITH WITH this gnTot = 0 lfStart2 = SECONDS() FOR lnI = 1 TO 10000000 test2() test2() test2() test2() test2() NEXT lfEnd2 = SECONDS() ? "Result passing by implicit WITH this", gnTot ? "" ENDWITH ? "" ? "Parameter time (in seconds):", lfEnd1 - lfStart1 ? "Implicit WITH time:", lfEnd2 - lfStart2 ENDDEFINE