mIRC Home    About    Download    Register    News    Help

Print Thread
bread faster than fread? #84516 29/05/04 01:57 PM
Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
hello, i am posting this here just to see if you can explain me this

alias speed_checker {
var %file = $shortfn($$sfile(c:,Select file to test (bigger than 80MB),Ok))

:slow
var %i = 0, %size = $file(%file).size
var %time = $ticks
while (%i <= %size) {
bread %file %i 10000000 &binvar
inc %i 10000000
}
echo 4 -............. $calc($ticks - %time) bread

:fast
.fopen lol %file
%time = $ticks

while (!$feof) {
bunset &binvar
var %i = $fread(lol,10000000, &binvar)
}

.fclose lol
echo 4 -............. $calc($ticks - %time) fread
goto slow
}

please ignore the 1 time since it is the 1 time the file is been readed.
don't forget to break the script execution when you belive you have enouf sample times.
since the fread is using an open handler to the file why is bread faster than fread?

this has not much to doo with cache, if you run each of the while in seperatly afer you restart windows you will also notice that bread is faster (a lot for files > 300MB)

this is just a notice, maybe fread needs some tweeks smile

thanks for your time

Re: bread faster than fread? #84517 29/05/04 02:25 PM
Joined: Nov 2003
Posts: 2,327
T
tidy_trax Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I believe it may be bunset &binvar slowing the fread down, try it without that.


New username: hixxy
Re: bread faster than fread? #84518 29/05/04 03:52 PM
Joined: Feb 2003
Posts: 307
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 307
i made the tests with bunset also in the other while loop, but i made some more tests and removed it then when i post i forgot to add it again.
The results i got where with bunset in the 2 loops.