|
From: Itamar M. L. J. L. <ita...@gm...> - 2015-06-28 01:42:40
|
Here another test, append with transaction works fine but soon after he
leaves the slower replace function yet.
Function main
LOCAL aStru := {{"DATA","c",50,0}}
setmode(25,80)
cls
request DBFCDX,LETO
rddsetdefault("LETO")
dbsetdriver("LETO")
dbcreate("//localhost:2812/test.dbf",aStru,"LETO")
DbUseArea(.t.,"LETO",'//localhost:2812/test.dbf','pd',.F.,.F.)
@ 01,10 say "Append records: " + time()
For n := 1 to 8000
pd->(DbAppend())
@ 02,10 say "Add records: " + str(n)
NEXT
@ 03,10 say "Final Append records: " + time()
zap
@ 05,10 say "Append records: " + time()
leto_BeginTransaction()
For n := 1 to 8000
pd->(DbAppend())
@ 06,10 say "Add records: " + str(n)
NEXT
leto_CommitTransaction()
@ 07,10 say "Final Append records: " + time()
pd->(DbGoTop())
@ 09,10 say "Initial replace with transaction: " + time()
leto_BeginTransaction()
do while pd->(!eof())
replace pd->DATA with "X"
pd->(DbSkip())
@ 10,10 say "Replace process..." + str(recno())
enddo
leto_CommitTransaction()
@ 11,10 say "Final replace with transaction: " + time()
close all
return nil
Best regards,
Itamar M. Lins Jr.
2015-06-27 22:24 GMT-03:00 Itamar M. Lins Jr. Lins <ita...@gm...>:
> Hi!
> Very slow!
> This code below demonstrates the problem!
> ---------------8<---------------
> Function main
> LOCAL aStru := {{"DATA","c",50,0}}
>
> setmode(25,80)
> cls
> request DBFCDX,LETO
> rddsetdefault("LETO")
> dbsetdriver("LETO")
> dbcreate("//localhost:2812/test.dbf",aStru,"LETO")
> DbUseArea(.t.,"LETO",'//localhost:2812/test.dbf','pd',.T.,.F.)
>
> @ 05,10 say "Append records: " + time()
> For n := 1 to 8000
> pd->(DbAppend())
> NEXT
> @ 06,10 say "Final Append records: " + time()
>
> pd->(DbGoTop())
>
> if(!flock())
> alert("Fail...")
> return nil
> endif
>
> @ 09,10 say "Initial replace with transaction: " + time()
> leto_BeginTransaction()
> do while pd->(!eof())
> replace pd->DATA with "X"
> pd->(DbSkip())
> @ 10,10 say "Process..." + str(recno())
> enddo
> leto_CommitTransaction()
> @ 11,10 say "Final replace with transaction: " + time()
>
> close all
> return nil
> ------------------------>8-----------------------
>
> I use for compile:
> hbmk2 leto_trans.prg \devl\letodb\rddleto.hbc
>
> LetoDB Changelog,v 1.350.2.239 2015/06/11
>
> Best regards,
> Itamar M. Lins Jr.
>
|