Id: 9757; Nick: Daveoh; Timestamp: 2008-04-26 13:09:03; Pasted as: mIRC
Description: Shows how using a decreasing while is sometimes not faster.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
alias testscript {
  var %i = 1, %a = 1000, %ticks1 = $ticks
  while (%a) {
    while ($comchan($me,%i)) {
      noop $v1
      inc %i
    }
    dec %a
  }
  var %ticks2 = $ticks
  var %a = 1000, %ticks3 = $ticks
  while (%a) {
    var %i = $comchan($me,0)
    while ($comchan($me,%i)) {
      noop $v1
      dec %i
    }
    dec %a
  }
  var %ticks4 = $ticks
  echo -agt Completed 1000 runs, inc took $calc(%ticks2 -%ticks1) $+ ms while dec took $calc(%ticks4 -%ticks3) $+ ms.
}
Options: New, Download,
, mIRC Parser;
Copyright © 2006 by Zyberdog - Some rights reserved. (Browse/Disclaimer/Stats/About)