mIRC Home    About    Download    Register    News    Help

Print Thread
#242467 18/07/13 06:55 AM
Joined: Jun 2013
Posts: 24
Z
Zabache Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jun 2013
Posts: 24
When using my remote script to data mine a large directory using $findfile, $ini, $readini and only one write and one echo line per read, mirc runs quickly through the first ten percent of the directory, reading several files per second, but once it has reached the ten percent mark, whether that be at 400 files, 800 or 1700 it slows to almost 1/3 its former rate for the duration and only reads one file per second after that. mirc or something has clearly hitting a wall... what wall? why 10% in each case? all ideas welcome and queries answered.

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
Could you please give us a sample of code you are using to come up with these stats? How many files are we talking about here?

Note: in case you didn't know, $findfile is a loop in itself, doing "var %a 1 | while ($findfile(dir,*,%a) != $null) { echo -a $v1 | inc %a }" is not proper and is indeed very very slow, because it has to reevaluate $findfile each time "noop $findfile(dir,*,0,echo -a $1-)" is proper.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #242472 18/07/13 11:30 PM
Joined: Jun 2013
Posts: 24
Z
Zabache Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jun 2013
Posts: 24
17k files in my search directory, and I'll spare you the code because after much work i resolved the problem to this conclusion... \+\ When reading this massive list of files, I discovered that this 10% slow down always occurred in a different location if i removed someone of the folders at the start of the directory, it would shift around and start a few files earlier based on how many i had removed. It eventually came to me that if the last directory was named \+\ as in D:\List\List\A\+\Filename.ini that the read rate of mirc would drop from > 3 per second to < one per second at the point it read from \+\ directory, and, ever after; turning a 30 minute $findfile routine into a 3 hour yawn. Seems room for improvement here. Otherwise fine work mIRC!

and, Could someone write me a while loop that illustrates a non-recursive $findfile... I use the following:

Code:
alias FasterPlease {
  var %1 = D:\List\List\, %2 = $findfile(%1,*,0), %3 = 1
  while (%2 >= %3) { var %fn = $findfile(%1,*,%3)

    inc %3
  }
}


and, what other non-recursive, fopen-like features might i be missing too? Faster is a huge help for my non-traditional uses of this fine coding environment.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Your horrendous variable names aside, just as Wims said.

Code:
alias FasterPlease {
  var %dir = D:\List\List\
  noop $findfile(%dir,*,0,callback $1-)
}

alias callback {

}

Joined: Jun 2013
Posts: 24
Z
Zabache Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jun 2013
Posts: 24
Hmm that is faster, thank you folks, another penny saved. And, common sense variables for common sense code I figure. I only name them where required by volume or posthumously after review, keep it simple I say. Thanks for the practical example it will help me muchly.


Are there any other non-recursives i should be aware of? and pardon my confusion in the earlier example but i have no idea what noop is?

Last edited by Zabache; 19/07/13 04:04 AM.
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Not much information, but anyway.

/help /noop

You can also use google to find out more.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jun 2013
Posts: 24
Z
Zabache Offline OP
Ameglian cow
OP Offline
Ameglian cow
Z
Joined: Jun 2013
Posts: 24
Code:
/zz {  }
/rp { $1- }

wink

thanks, i'll try it your way.


Link Copied to Clipboard