> >

> > This is my test.

> >

> >

LOCAL lnmult,cc[4],lni,lnRecno,ttt,lnRec
> > CLEAR
> > CLOSE DATABASES ALL
> > RAND(-1)
> > SET DELETED OFF && ON
> > lnRecno = 100
> > FOR lnmult = 1 TO 3 && 4 && 5
> > cc[m.lnmult] = SYS(2015)
> > CREATE TABLE (cc[m.lnmult]) (ii I,cc C(10))
> > lnRecno = m.lnRecno * 10 && 1000, 10000, 100000, 1000000, 10000000
> > ?
> > ? ' cursor with ' + TRANSFORM(m.lnRecno) + 'rows'
> > *!* APPEND BLANK
> > *!* DELETE
> > FOR lni = 1 TO m.lnRecno
> > INSERT INTO (cc[m.lnmult]) VALUES (m.lni,SYS(2015))
> > NEXT
> > *!* APPEND BLANK
> > *!* DELETE
> >
> > *!* INDEX on cc TAG cc DESCENDING
> > *!* SET ORDER TO cc
> >
> > *!* SET FILTER TO ii % 100 = 0
> >
> > ? "1000 go bottom, step " + TRANSFORM(10 ^(m.lnmult-1))
> > ttt = SECONDS()
> > FOR lnRec = 1 TO 1000
> > GO MAX(m.lnRec * 10 ^(m.lnmult-1),1)
> > SKIP -1
> > GO BOTTOM
> > NEXT
> > ? SECONDS() - ttt
> >
> > ? "1000 locate .F., step " + TRANSFORM(10 ^(m.lnmult-1))
> > ttt = SECONDS()
> > FOR lnRec = 1 TO 1000
> > GO MAX(m.lnRec * 10 ^(m.lnmult-1),1)
> > SKIP -1
> > LOCATE FOR .F.
> > NEXT
> > ? SECONDS() - ttt
> >
> > ? "1000 go bottom, random"
> > ttt = SECONDS()
> > FOR lnRec = 1 TO 1000
> > GO MAX(INT(m.lnRecno * RAND()),1)
> > SKIP -1
> > GO BOTTOM
> > NEXT
> > ? SECONDS() - ttt
> >
> > ? "1000 locate .F., random"
> > ttt = SECONDS()
> > FOR lnRec = 1 TO 1000
> > GO MAX(INT(m.lnRecno * RAND()),1)
> > SKIP -1
> > LOCATE FOR .F.
> > NEXT
> > ? SECONDS() - ttt
> >
> > FOR lni = 1 TO m.lnRecno
> > APPEND BLANK
> > NEXT
> > ? "1000 go top, step " + TRANSFORM(10 ^(m.lnmult-1))
> > ttt = SECONDS()
> > FOR lnRec = 1 TO 1000
> > GO m.lnRec * 10 ^(m.lnmult-1)
> > SKIP -1
> > GO TOP
> > NEXT
> > ? SECONDS() - ttt
> >
> > ? "1000 locate, step " + TRANSFORM(10 ^(m.lnmult-1))
> > ttt = SECONDS()
> > FOR lnRec = 1 TO 1000
> > GO m.lnRec * 10 ^(m.lnmult-1)
> > SKIP -1
> > LOCATE
> > NEXT
> > ? SECONDS() - ttt
> >
> > ? "1000 go top, random"
> > ttt = SECONDS()
> > FOR lnRec = 1 TO 1000
> > GO MAX(INT(m.lnRecno * RAND()),1)
> > SKIP -1
> > GO TOP
> > NEXT
> > ? SECONDS() - ttt
> >
> > ? "1000 locate, random"
> > ttt = SECONDS()
> > FOR lnRec = 1 TO 1000
> > GO MAX(INT(m.lnRecno * RAND()),1)
> > SKIP -1
> > LOCATE
> > NEXT
> > ? SECONDS() - ttt
> > NEXT

> >

> > Respectfully

>

>

> Hi Vilhelm,

>

> Interesting as your elapse timing adds more with what one would experience

> in a real-work application "where-as" my code only looks at the actual

> two commands and their times.

>

> The other thing you need to do is not introduce the FOR condition

> LOCATE FOR .F.

> is a different thing when compared against

> LOCATE = .F.

>

> One can easily see the speed improvement by dropping the FOR condition in

> your code example and re-run to see what impact FOR has..

>

> Below are parts times with the FOR condition removed . . .

>

>

> Based upon my testing and yours I honestly do not see any major speed advantage to either

> one, but it seems like the GOTO BOTTOM for the most part edges out ahead in speed. So

> little difference though either one would work almost interchangeably.

> I went with GOTO BOTTOM several years ago as at that time as I recall this back then in my

> testing GOTO BOTTOM had a very slight speed advantage over the LOCATE = .F.

>

> So which one you going to use ? ;-) ;-) ;-) ;-)

>

> Pete "the IceMan", from the Great White North of Canada.

>

www.marathongriffincomputers.comHi Pete,

I posted the test without comments, because, like you, I also was intrigued.

It's my first test, and I'm not very sure if I did it right.

I also tried SET FILTER, SET DELETED...

I guess Locate = .F. don't move the record pointer, but creates a memory variable named Locate and give them the value .F., instead.

I remember I read that LOCATE is faster than Go Top only under some certain conditions, and slower in rest.

Respectfully