mIRC Home    About    Download    Register    News    Help

Print Thread
#266262 31/10/19 06:10 PM
Joined: Dec 2015
Posts: 148
Dazuz Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Dec 2015
Posts: 148
This is a request for a closer look. Basically, optimization if possible!

There seems to be, and has been for a long time, a massive difference in the speed between $bfind(&bvar,1,string).text and $bfind(&bvar,1,115 116 114 105 110 103).

I understand they're doing something different, but the difference seems way too massive to be normal.

test #1: 1360 <-- $bfind().text
test #2: 219 <-- $bfind
test #3: 171 <-- $wildtok & $findtok at the same time for fun!

Code
alias test1 {
  set -l %ticks $ticks
  set -l %x 10000
  bset -t &bvar -1 $teststring
  while (%x) {
    noop $bfind(&bvar,1,multi-user).text
    dec %x
  }
  echo -a test #1: $calc($ticks - %ticks)
}

alias test2 {
  set -l %ticks $ticks
  set -l %x 10000
  bset -t &bvar -1 $teststring
  while (%x) {
    noop $bfind(&bvar,1,109 117 108 116 105 45 117 115 101 114)
    dec %x
  }
  echo -a test #2: $calc($ticks - %ticks)
}

alias test3 {
  set -l %ticks $ticks
  set -l %x 10000
  set -l %string $teststring
  while (%x) {
    noop $wildtok(%string,multi-user,1,32)  $findtok(%string,multi-user,1,32)
    dec %x
  }
  echo -a test #3: $calc($ticks - %ticks)
}

alias teststring {
  return mIRC is a full featured Internet Relay Chat client for Windows that $&
    can be used to communicate, share, play or work with others on IRC $&
    networks around the world, either in multi-user group conferences $&
    or in one-to-one private discussions.
}

Joined: Dec 2015
Posts: 148
Dazuz Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Dec 2015
Posts: 148
Almost forgot, it's faster to convert the string manually than use $bfind().text.

test #4: 281
Code
alias test4 {
  set -l %ticks $ticks
  set -l %x 10000
  bset -t &bvar -1 $teststring
  while (%x) {
    bset -t &string -1 multi-user
    noop $bfind(&bvar,1,$bvar(&string,1-))
    bunset &string
    dec %x
  }
  echo -a test #4: $calc($ticks - %ticks)
}

alias teststring {
  return mIRC is a full featured Internet Relay Chat client for Windows that $&
    can be used to communicate, share, play or work with others on IRC $&
    networks around the world, either in multi-user group conferences $&
    or in one-to-one private discussions.
}

Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
The $bfind().text method involves more overhead. I have found a way of moving some of this outside of the search loop. This change will be in the next beta.


Link Copied to Clipboard