mIRC Homepage

Eliminate "not responding" and trembling

Posted By: EUDIS1980

Eliminate "not responding" and trembling - 09/02/15 01:45 PM

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?
Posted By: westor

Re: Eliminate "not responding" and trembling - 09/02/15 01:48 PM

If you can provide us your code that is doing this maybe we can..
Posted By: EUDIS1980

Re: Eliminate "not responding" and trembling - 09/02/15 02:58 PM

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.
Posted By: Loki12583

Re: Eliminate "not responding" and trembling - 09/02/15 03:50 PM

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.
Posted By: EUDIS1980

Re: Eliminate "not responding" and trembling - 09/02/15 06:24 PM

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!
© 2020 mIRC Discussion Forums