CLEAR CLOSE DATABASES all = creacurs() IF .t. #define C__EXACT_TIMING .f. #if C__EXACT_TIMING SET PROCEDURE TO ..\..\_commonTG\prg\timing additive = queryPerf_Setup() #endif private ; pnRun, pnStop, pnTestNum, puVal, pnAppSize, pnOps, pnOpsStop, pnMeasure, ; pcCursname, ; paStartMS, paEndMS, paFuncs, paUsed pnMeasure = 300 DIMENSION paStartMS[m.pnMeasure], paEndMS[m.pnMeasure], paFuncs[m.pnMeasure], paUsed[1] pnStop = 3000 pnTestNum = 0 pnOpsStop = 20 pnAppSize = 2 pcCursName = "MyCurs" = TestSuite() LOCAL lnGrowth, lnTarget FOR lnGrowth = 5 TO 11 lnTarget = INT(m.pnAppSize**m.lnGrowth) ? "creating temp. Cursors:", m.lnTarget FOR pnRun = 1 TO m.lnTarget = creacurs("Dummy" + PADL(ALLTRIM(STR(m.pnRun, 6, 0)), 4, "0")) NEXT SELECT myCurs = TestSuite() NEXT FOR pnRun = 1 TO ALEN(paStartMS, 1) IF VARTYPE(paStartMS[m.pnRun]) == "N" ? paFuncs[m.pnRun] endif NEXT else = anylib() myCurs = createobject("custom") = ADDPROPERTY(myCurs, "cMyField", "in Object") ? m.myCurs.cMyField, myCurs.cMyField *-- simulate m.mycurs will be evaluated first! USE IN myCurs *-- this would use the objects property under Peter's rule = anylib() myCurs.cMyField = 5 *-- errors are WELCOME here! = anylib() ENDIF #if C__EXACT_TIMING #else FUNCTION getTime_ms() return seconds()*1000 #endif function testsuite() ? "Begin Testsuite, Reads:" + STR(m.pnStop*m.pnOpsStop, 11) = isselected() = withOpSelect() = withOpSelectString() = WithoutSelect() = withAlwaysSelect() = WithEval() FUNCTION isselected() LOCAL lnOldSel lnOldSel = SELECT() SELECT myCurs = testStart() FOR pnRun = 1 TO m.pnStop FOR pnOpRun = 1 TO m.pnOpsStop puVal = nMyNum next NEXT SELECT (m.lnOldSel) = testStop() FUNCTION withOpselect() LOCAL lnOldSel = testStart() FOR pnRun = 1 TO m.pnStop lnOldSel = SELECT() SELECT myCurs FOR pnOpRun = 1 TO m.pnOpsStop puVal = nMyNum NEXT SELECT (m.lnOldSel) NEXT = testStop() FUNCTION withOpselectString() LOCAL lnOldSel = testStart() FOR pnRun = 1 TO m.pnStop lnOldSel = SELECT() SELECT (m.pcCursname) FOR pnOpRun = 1 TO m.pnOpsStop puVal = nMyNum NEXT SELECT (m.lnOldSel) NEXT = testStop() FUNCTION withAlwaysSelect() LOCAL lnOldSel = testStart() FOR pnRun = 1 TO m.pnStop FOR pnOpRun = 1 TO m.pnOpsStop lnOldSel = SELECT() SELECT myCurs puVal = nMyNum SELECT (m.lnOldSel) next NEXT = testStop() FUNCTION withoutselect() = testStart() FOR pnRun = 1 TO m.pnStop FOR pnOpRun = 1 TO m.pnOpsStop puVal = MyCurs.nMyNum next NEXT = testStop() FUNCTION withEval() = testStart() FOR pnRun = 1 TO m.pnStop FOR pnOpRun = 1 TO m.pnOpsStop puVal = EVALUATE(m.pcCursName + ".nMyNum") next NEXT = testStop() FUNCTION TestStart() pnTestNum = m.pnTestNum + 1 paStartMS[m.pnTestNum] = getTime_ms() FUNCTION TestStop() paEndMS[m.pnTestNum] = getTime_ms() paFuncs[m.pnTestNum] = ; STR(paEndMS[m.pnTestNum] - paStartMS[m.pnTestNum], 17, 3) + ; Str(aUSed(paUsed), 6) + ; STR(m.pnStop*m.pnOpsStop, 11) + ; " " + program(PROGRAM(-1)-1) FUNCTION creacurs(tcName) IF EMPTY(tcName) tcName = "myCurs" endif CREATE CURSOR (m.tcName) (cMyField C(20), nMyNum N(5)) INSERT INTO (m.tcName) (cMyField, nMyNum) VALUES ("MyField in MyCurs", 5) FUNCTION anylib *-- Supposed to work on the cursor field ? ALLTRIM(myCurs.cMyField)