>create cursor x1 ( comment01 c(100), ; > comment02 c(100), ; > comment03 c(100), ; > comment04 c(100), ; > comment05 c(100) ) > >scatter name loData blank > >insert into x1 values ( "", replicate( 'x', 30 ), replicate( 'y', 60 ), ; > replicate( 'z', 90 ), replicate( 'a', 100 ) ) > >? "Test a large trim" > >ltStart = seconds() > >for i = 1 to 100000 > for j = 1 to 5 > store alltrim( x1.comment01 ) to ("loData.comment" + padl( m.j, 2, '0' ) ) > endfor >endfor > >ltStart = seconds() - ltStart >? "store:", ltStart > >ltStart = seconds() > >for i = 1 to 100000 > for j = 1 to 5 > addproperty( loData, "comment" + padl( m.j, 2, '0' ), alltrim( x1.comment01 ) ) > endfor >endfor > >ltStart = seconds() - ltStart >? "AddProperty:", ltStart > > >? "Test a short trim" > >ltStart = seconds() > >for i = 1 to 100000 > for j = 1 to 5 > store alltrim( x1.comment04 ) to ("loData.comment" + padl( m.j, 2, '0' ) ) > endfor >endfor > >ltStart = seconds() - ltStart >? "store:", ltStart > >ltStart = seconds() > >for i = 1 to 100000 > for j = 1 to 5 > addproperty( loData, "comment" + padl( m.j, 2, '0' ), alltrim( x1.comment04 ) ) > endfor >endfor > >ltStart = seconds() - ltStart >? "AddProperty:", ltStart > >? "Test just raw store vs. addproperty()" > >ltStart = seconds() > >for i = 1 to 100000 > for j = 1 to 5 > store alltrim( x1.comment01 ) to loData.comment01 > endfor >endfor > >ltStart = seconds() - ltStart >? "store:", ltStart > >ltStart = seconds() > >for i = 1 to 100000 > for j = 1 to 5 > addproperty( loData, "comment01", alltrim( x1.comment01 ) ) > endfor >endfor > >ltStart = seconds() - ltStart >? "AddProperty:", ltStart > >? "Test all comments to properties" > >ltStart = seconds() > >for i = 1 to 100000 > for j = 1 to 5 > lcName = padl( m.j, 2, '0' ) > store alltrim( evaluate( "x1.comment" + lcName ) ) to ("loData.comment" + lcName ) > endfor >endfor > >ltStart = seconds() - ltStart >? "store:", ltStart > >ltStart = seconds() > >for i = 1 to 100000 > for j = 1 to 5 > lcName = padl( m.j, 2, '0' ) > addproperty( loData, "comment" + lcName, alltrim( evaluate( "x1.comment" + lcName ) ) ) > endfor >endfor > >ltStart = seconds() - ltStart >? "AddProperty:", ltStart > >? "Test just raw store vs. addproperty() for all comments" > >ltStart = seconds() > >for i = 1 to 100000 > store alltrim( x1.comment01 ) to loData.comment01 > store alltrim( x1.comment02 ) to loData.comment02 > store alltrim( x1.comment03 ) to loData.comment03 > store alltrim( x1.comment04 ) to loData.comment04 > store alltrim( x1.comment05 ) to loData.comment05 >endfor > >ltStart = seconds() - ltStart >? "store:", ltStart > >ltStart = seconds() > >for i = 1 to 100000 > addproperty( loData, "comment01", alltrim( x1.comment01 ) ) > addproperty( loData, "comment02", alltrim( x1.comment02 ) ) > addproperty( loData, "comment03", alltrim( x1.comment03 ) ) > addproperty( loData, "comment04", alltrim( x1.comment04 ) ) > addproperty( loData, "comment05", alltrim( x1.comment05 ) ) >endfor > >ltStart = seconds() - ltStart >? "AddProperty:", ltStart >>
CLEAR create cursor x1 ( comment01 c(100), ; comment02 c(100), ; comment03 c(100), ; comment04 c(100), ; comment05 c(100) ) scatter name loData blank insert into x1 values ( "", replicate( 'x', 30 ), replicate( 'y', 60 ), ; replicate( 'z', 90 ), replicate( 'a', 100 ) ) ? "David's wrong VFP code: wthou m. VFP loop into the x1 fields" DavidBadCode() SELECT 0 ? ? "workaround for wrong code: unselect a active alias" DavidBadCode() SELECT x1 ? ? "correct test" CorrectCode() PROCEDURE DavidBadCode ? "Test a large trim" ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 store alltrim( x1.comment01 ) to ("loData.comment" + padl( m.j, 2, '0' ) ) endfor endfor ltStart = seconds() - ltStart ? "store:", ltStart ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 addproperty( loData, "comment" + padl( m.j, 2, '0' ), alltrim( x1.comment01 ) ) endfor endfor ltStart = seconds() - ltStart ? "AddProperty:", ltStart ? "Test a short trim" ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 store alltrim( x1.comment04 ) to ("loData.comment" + padl( m.j, 2, '0' ) ) endfor endfor ltStart = seconds() - ltStart ? "store:", ltStart ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 addproperty( loData, "comment" + padl( m.j, 2, '0' ), alltrim( x1.comment04 ) ) endfor endfor ltStart = seconds() - ltStart ? "AddProperty:", ltStart ? "Test all comments to properties" ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 lcName = padl( m.j, 2, '0' ) store alltrim( evaluate( "x1.comment" + lcName ) ) to ("loData.comment" + lcName ) endfor endfor ltStart = seconds() - ltStart ? "store:", ltStart ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 lcName = padl( m.j, 2, '0' ) addproperty( loData, "comment" + lcName, alltrim( evaluate( "x1.comment" + lcName ) ) ) endfor endfor ltStart = seconds() - ltStart ? "AddProperty:", ltStart ENDPROC **************************************** PROCEDURE CorrectCode ? "Test a large trim" ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 store alltrim( x1.comment01 ) to ("loData.comment" + padl( m.j, 2, '0' ) ) endfor endfor ltStart = seconds() - ltStart ? "store:", ltStart ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 addproperty( m.loData, "comment" + padl( m.j, 2, '0' ), alltrim( x1.comment01 ) ) endfor endfor ltStart = seconds() - ltStart ? "AddProperty:", ltStart ? "Test a short trim" ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 store alltrim( x1.comment04 ) to ("loData.comment" + padl( m.j, 2, '0' ) ) endfor endfor ltStart = seconds() - ltStart ? "store:", ltStart ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 addproperty( m.loData, "comment" + padl( m.j, 2, '0' ), alltrim( x1.comment04 ) ) endfor endfor ltStart = seconds() - ltStart ? "AddProperty:", ltStart ? "Test all comments to properties" ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 lcName = padl( m.j, 2, '0' ) store alltrim( evaluate( "x1.comment" + m.lcName ) ) to ("loData.comment" + m.lcName ) endfor endfor ltStart = seconds() - ltStart ? "store:", ltStart ltStart = seconds() for i = 1 to 100000 for j = 1 to 5 lcName = padl( m.j, 2, '0' ) addproperty( m.loData, "comment" + m.lcName, alltrim( evaluate( "x1.comment" + m.lcName ) ) ) endfor endfor ltStart = seconds() - ltStart ? "AddProperty:", ltStart ENDPROC>>not tests are necessary, because if the VFP's C++ implementation is correct