mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jul 2006
Posts: 4,149
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
It seems to me a single filter -fw call should be way faster because the lines do not have to be displayed in the window before hand (even if the window is hidden), but it's not the case.

Maybe this is wrong assumption but it seems to me that it illustrates /filter -f is not doing things as fast as /loadbuf is, any idea?


Code
alias testfilter {
;create 165K lines in the form "ab 123"
if (!$file(bf.txt)) { var %l 165000 | while (%l) { write bf.txt $r(a,z) $+ $r(a,z) $r(1,10000) | dec %l } }
var %t $ticks
window -hj1000000 @w
loadbuf @w bf.txt
filter -ceutww 2 32 @w @w
echo -sg in $calc($ticks - %t) ms
clear @w
%t = $ticks
filter -ceutfw 2 32 bf.txt @w
echo -sg in $calc($ticks - %t) ms
window -c @w
}
Typical average result on my machine:
Quote
in 1825 ms
in 3338 ms
Currently it's way faster to use /loadbuf + /filter -ww, that feels wrong.

Last edited by Wims; 28/03/22 12:45 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
On my system, the timings are in 7204 ms and 9015 ms. This is actually surprisingly close considering that /loadbuf has one purpose, to load a whole file quickly, which it has been optimized to do. The /filter command, on the other hand, is a generic line filtering function that processes/parses single lines from different types of inputs, so in this case it is reading lines one by one from the file and it is the speed of the file reading and line parsing that is making a difference here.


Link Copied to Clipboard