mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2015
Posts: 18
E
Pikka bird
OP Offline
Pikka bird
E
Joined: Feb 2015
Posts: 18
Hi,

Having to load thousands of lines in a list by using a While loop, causes the list to tremble, flash, mirc goes in "not responding", and other disturbing effects. Has anyone faced such a situation? And how you resolved it?

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
If you can provide us your code that is doing this maybe we can..


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Feb 2015
Posts: 18
E
Pikka bird
OP Offline
Pikka bird
E
Joined: Feb 2015
Posts: 18
It's nothing unusual, just a loop for loading .ini contents:

Code:
on *:dialog:msgdx:init:*:{
  mdx MarkDialog $dname
  mdx SetDialog $dname style tool title
  mdx SetControlMDX $dname 11 ListView grid rowselect report > views.mdx
  did -i $dname 11 1 headerdims 70 170 360 90
  did -i $dname 11 1 headertext $+(ID,$chr(9),NAME,$chr(9),MESSAGE,$chr(9),ACTION)
  did -f $dname 4
  .timer -h 1 50 dx.load $dname 11
}

alias dx.load {
  if ($dialog($1)) {
    var %tmp = 1, %tot = $ini("sysdata\dxtemp.ini",basic,0)
    while (%tmp <= %tot) {
      var %1 = $gettok($readini("sysdata\dxtemp.ini",basic,%tmp),1,33)
      var %2 = $gettok($readini("sysdata\dxtemp.ini",basic,%tmp),2,33)
      var %3 = $gettok($readini("sysdata\dxtemp.ini",basic,%tmp),3,33)
      var %4 = $gettok($readini("sysdata\dxtemp.ini",basic,%tmp),4,33)
      did -a $1 $2 $+(0 0 0 %1,$chr(9),%2,$chr(9),%3,$chr(9),%4)
      inc %tmp
    }
  }
}


File dxtemp.ini contains 3,400 records. When loading, the problem that i mentioned in my first post accurs.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
mIRC is single threaded, the GUI ruins on the same thread as everything else so if you have a script that takes a long time to execute it holds up everything else mIRC is doing. Try refactoring the code to be more efficient. INI file access should already be pretty fast because it's supposed to be cached, but you may try loading the INI file to a hash table with the /hload command and looping over that. Referencing properties by their key is more efficient than looping over $hget().item. If this doesn't speed things up, instead of doing all 3,400 entries at once start a number of timers to stagger them.

Joined: Feb 2015
Posts: 18
E
Pikka bird
OP Offline
Pikka bird
E
Joined: Feb 2015
Posts: 18
I haven't even thought about using hash tables. I was trying using /loadbuf instead of a loop, but hashes work even faster. Thank you for your idea!


Link Copied to Clipboard