I did a quick check, and fopen buffering doesn't make much difference,
but fflush() does.
VFP is obviously doing some smoke & mirrors even with llfc - because the
first iteration is always slower:
CLEAR MEMORY
Clear
_screen.AddProperty('count')
FOR _screen.count = 1 TO 4
&& buffered
t1 = SECONDS()
bStr=REPLICATE('#', 1000000)
hF=FOPEN('f1.txt',2)
FWRITE(hF,bStr)
&& FFLUSH(hF, .T.)
?'bStr', SECONDS()-t1
FCLOSE(hF)
DELETE FILE f1.txt
CLEAR MEMORY
t1 = SECONDS()
hF=FOPEN('f2.txt',2)
FOR i = 1 TO 1000000
FWRITE(hF, '#')
NEXT i
?'dsk', SECONDS()-t1
FCLOSE(hF)
DELETE FILE f2.txt
CLEAR MEMORY
&& UNbuffered
t1 = SECONDS()
bStr=REPLICATE('#', 1000000)
hF=FOPEN('f1.txt',2)
FWRITE(hF,bStr)
?'bStrNB', SECONDS()-t1
FCLOSE(hF)
DELETE FILE f1.txt
CLEAR MEMORY
t1 = SECONDS()
hF=FOPEN('f2.txt',2)
FOR i = 1 TO 1000000
FWRITE(hF, '#')
NEXT i
?'dskNB', SECONDS()-t1
FCLOSE(hF)
DELETE FILE f2.txt
CLEAR MEMORY
&& now with fflush
t1 = SECONDS()
bStr=REPLICATE('#', 1000000)
hF=FOPEN('f1.txt',2)
FWRITE(hF,bStr)
FFLUSH(hF, .T.)
?'bStrff', SECONDS()-t1
FCLOSE(hF)
DELETE FILE f1.txt
CLEAR MEMORY
t1 = SECONDS()
hF=FOPEN('f2.txt',2)
FOR i = 1 TO 1000000
FWRITE(hF, '#')
FFLUSH(hF, .T.)
NEXT i
?'dskff', SECONDS()-t1
FCLOSE(hF)
DELETE FILE f2.txt
CLEAR MEMORY
t1 = SECONDS()
bStr=REPLICATE('#', 1000000)
hF=FOPEN('f1.txt',2)
FWRITE(hF,bStr)
FFLUSH(hF, .T.)
?'bStrNBff', SECONDS()-t1
FCLOSE(hF)
DELETE FILE f1.txt
CLEAR MEMORY
t1 = SECONDS()
hF=FOPEN('f2.txt',2)
FOR i = 1 TO 1000000
FWRITE(hF, '#')
FFLUSH(hF, .T.)
NEXT i
?'dskNBff', SECONDS()-t1
FCLOSE(hF)
DELETE FILE f2.txt
CLEAR MEMORY
?''
NEXT
CLEAR ALL
CLOSE ALL
RELEASE ALL
&& sorry about the _screen.count kludge (and there doesn't seem to be a
deleteprop method).
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/55169acd.2050...@hawthorncottage.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.