mIRC Home    About    Download    Register    News    Help

Print Thread
Beta slower at joining/disconnecting #269962 25/02/22 01:39 PM
Joined: Feb 2011
Posts: 403
K
KindOne Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 403
It looks like all the 7.67 beta's are a slightly slower at joining all the channels. Entering "/scon -a disconnect" is also slower. This is not noticeable unless you on a large amount of networks and channels.

Stock mIRC, only settings I've changed are in the script and disabled all logging.

Video of 7.67 (left) and 7.76.5285 (right) both being opened at the same time with the same script below.

https://www.dropbox.com/s/hv09e4ssjkhf2fp/2022-02-25%2008-13-15.mkv?dl=0

Batch file:
Code
start C:\speed\release\mirc-7.67.exe
start C:\speed\beta\mirc-7.67.5285.exe


Script:

Code
raw 376:*:{
  var %x 5
  while (%x) {
    join -n $chr(35) $+ $rand(10000,99999)
    dec %x
  }
}
on *:start:{
  window -iez @test
  set %time $ctime

  ; Don't spam screen on disconnect.
  tips off

  ; I don't use this.
  switchbar off

  var %server_address 192.168.254.74:7000
  server %server_address  -i KindOne $+ $beta
  var %x 20 | while (%x) { server -m %server_address -i KindOne $+ %x $+ $beta | dec %x }

}
on *:join:#:{
  if ($nick == $me) { echo @test $calc($ctime - %time) seconds to join }
}

; Test how long it takes to disconnect from everything at once.
; //var %x $ctime | scon -a disconnect | echo -ag $calc($ctime - %x) seconds



I used sol


irc.swiftirc.net #msl (mIRC Scripting Language)
Re: Beta slower at joining/disconnecting [Re: KindOne] #269963 26/02/22 12:00 AM
Joined: Dec 2002
Posts: 5,104
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,104
Thanks for your bug report and the script to reproduce the issue.

I was able to track this issue to Item 11 in beta.txt, the change in the subclassing method. I changed the subclassing method from SetWindowLongPtr() to SetWindowSubClass() as it had been on my to-do list for some time as a more robust of method of subclassing.

I was able to pinpoint the slowdown, using a profiler, to the DefSubclassProc() API call. DefSubClassProc() simply tells the window procedure to call the next handler in the window chain. As far as I can tell, this API seems to be slower than the older subclass method that uses CallWindowProc() to call the next handler. The SetWindowSubClass() / DefSubClassProc() APIs are provided by Comctl32.dll, as opposed to User32.dll. I have no idea how Comctl32.dll implements subclassing - it is meant to be more robust and maintains an internal list of subclassed window procedures along with unique ids to identify all subclass instances. Windows in mIRC are heavily subclassed - so every window that is created has multiple subclasses relating to the display area, editbox, listbox, scrollbar, and so on to customize behaviour. When a hundred windows are opened, this results in a large number of unique subclass instances. Another issue that the profiler picked up is that the Comctl32.dll subclass method seems to use GetProp() internally, possibly to track windows, which is slower than GetWindowLongPtr(). Unfortunately, that is all the profiler could pick up.

I have reverted the use of the new subclass method for the treebar and this has resolved the issue. At this point, I am tempted to revert the new subclass method for all features but I am going to do a little more testing to see if it is necessary. This change will be in the next beta.

Re: Beta slower at joining/disconnecting [Re: Khaled] #270025 12/03/22 03:09 AM
Joined: Feb 2011
Posts: 403
K
KindOne Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 403
I re-ran the test three times with the 7.67.5925 beta. The beta is now slightly faster than the 7.67 release.

OnStart Script:

21 seconds - 7.67
16 seconds - 7.67.5925
...
21 seconds - 7.67
15 seconds - 7.67.5925
...
19 seconds - 7.67
14 seconds - 7.67.5925

---

//var %x $ctime | scon -a disconnect | echo -ag $calc($ctime - %x) seconds

6 seconds - 7.67
0 seconds - 7.67.5925
...
5 seconds - 7.67
0 seconds - 7.67.5925
...
5 seconds - 7.67
0 seconds - 7.67.5925

Thanks.


irc.swiftirc.net #msl (mIRC Scripting Language)