I notice that enumerating $ialchan() is awfully slow compared to $ial(). So slow in fact, that it is twice faster to perform a WHO #chan or /ialfill and scrape data from the RAW numeric responses.
Some experiments to perform.
1) Connect to freenode and join #freenode (a large channel).
2) Populate the IAL
/ialfill #freenode
3) Enumerate $ial(*,%i)
//var %i = 1, %n = $ial(*,0), %cnt = 0, %ticks = $ticks | WHILE (%i < %n) { if ($ial(*,%i)) { inc %cnt } | inc %i } | echo -a * %cnt of %n - $calc($ticks - %ticks) ms.
Result: * 1575 of 1577 - 140 ms.
4) Enumerate $ialchan(*,#,%i)
//var %i = 1, %n = $ialchan(*,#,0), %cnt = 0, %ticks = $ticks | WHILE (%i < %n) { if ($ialchan(*,#,%i)) { inc %cnt } | inc %i } | echo -a * %cnt of %n - $calc($ticks - %ticks) ms.
Result: * 1575 of 1577 - 9844 ms.
Now join several very large channels (from /list) and /ialfill them too, then repeat the last command (4).
You will find that $ialchan() gets slower and slower the larger that the server's $ial() becomes.
* 7289 of 9374 - 1279 ms. $ial()
* 1205 of 1580 - 16973 ms. $ialchan()
-
The effects appear to be identical when retrieving properties of $ial() and $ialchan().
//var %i = 1, %n = $ial(*,0), %cnt = 0, %ticks = $ticks | WHILE (%i < %n) { if ($ial(*,%i).account) { inc %cnt } | inc %i } | echo -a * %cnt of %n - $calc($ticks - %ticks) ms.
//var %i = 1, %n = $ialchan(*,#,0), %cnt = 0, %ticks = $ticks | WHILE (%i < %n) { if ($ialchan(*,#,%i).account) { inc %cnt } | inc %i } | echo -a * %cnt of %n - $calc($ticks - %ticks) ms.
The above commands will count how many users are logged into a nickserv account, globally or for the specific channel.