I apologise for misconstruing the efficiency of the expression as I posted it. I also apologise since, it seems from a little bit of further research, that mIRC's handling of inline if statements is grossly less efficient than I'd thought. In any other language, interpreted or not, they're handled with a rather great deal more speed than mIRC.
I was taught that regardless of the implementation of the regular expression, using a regular expression with no regards to the specific content of the text - that is, if the regular expression needs to be invoked at all - should be frowned upon in favour of simpler if statements to check if the complexity of a regular expression is required. Unfortunately, when it comes to mIRC, this method of thinking is less efficient than desired, but presuming the average percentage of lines containing 'BBCode' is under 90%, there's still advantage to be gained with the use of an if statement. Execution speed when only 5% of lines contain 'BBCode' is nearly halved, while when 95% of lines contain 'BBCode' execution speed is slower by 10%. (For reference, the percentage at which the two methods apparently reach equal execution times is 89.7%, although I doubt that the method of testing we're using is accurate to that level of precision.)

And, in case you're curious, the adaption to your speedcheck alias which I used to test this out is:

alias speedcheck {

  ;Play with average percentage of lines containing []s
  var %perc 897
  ;var %perc 500

  var %b = 20000
  !var  %t = $ticks
  while (%b) {
    var %a = $iif($r(1,1000) > %perc,$str(abcd,100),$str(aaa[ $str(b,30) ]ccc,10))
    if ([ isin %a) { !noop $regsubex(%a,/\[[^]]+\]/g,) }
    else { !noop %a }
    !dec %b
  }
  !var %c = $ticks - %t

  var %b = 20000
  !var %t = $ticks
  while (%b) {
    var %a = $iif($r(1,1000) > %perc,$str(abcd,100),$str(aaa[ $str(b,30) ]ccc,10))
    !noop $regsubex(%a,/\[[^]]+\]/g,)
    !dec %b
  }
  !var %d = $ticks - %t

  echo -a First method: %c ms -- Second method: %d ms
}

Anyway, Jaytea, thankyou for giving me the opportunity to learn a little more.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.