<div dir="ltr">Last email was probably eaten by hungry mailing list - resending it just in case!<br><br>Hello :]<br><br>I had some time to do more tests experimenting with custom event dispatchers.<br>To give more background, my use case is as follows:<br><br>1. There is one main thread - 'Server' - that currently contains QWebSocketServer instance serving data to clients<br>2. There is one or more threads doing some additional work - 'Rooms'<br><br>Every client sends some data to server with frequency of 20Hz, by first passing custom QEvent from Room thread to Server thread.<br>Server sends some data to every client with frequency of 20Hz.<br>Typically there are around 1-8 clients per server instance.<br><br>The goal was to check if I could 'speed it up' a bit by subclassing QAbstractEventDispatcher and integrating libuv into my stack.<br>Some modifications were made to the sources of Qt:<br><br>1. As suggested by Thiago Macieira I have added to the QAbstractEventDispatcher functions:<br><br>void enableSocketNotifier(noitifier)<br>void disableSocketNotifier(noitifier)<br><br>This allowed me to have finer control over when I want to destroy internal liuv poll handlers and when I just want enable or disable them.<br><br>2. I have added small helper to the QSocketNotifier - a C-like, void* handler to which I'm able to 'attach stuff'.<br>While not very pretty it allows me to completely remove parts of the code that are responsible for bookkeeping relations between sockets and libuv's pollers.<br><br>VTune data from my 'production-like' server [ 1x2GHz vCore, 1GB RAM on OVH cluster ] is here:<br>qt_native:<br><a href="https://drive.google.com/open?id=1mpRVEcuZWr9YCibXkl_acqjtJPhstept">https://drive.google.com/open?id=1mpRVEcuZWr9YCibXkl_acqjtJPhstept</a><br><br>libuv:<br><a href="https://drive.google.com/open?id=1YEih47QZHHg0V8N90moSxjU7Diu4qLgm">https://drive.google.com/open?id=1YEih47QZHHg0V8N90moSxjU7Diu4qLgm</a><br><br>Generally it is looking nice. I was able to shave 15% - 20% total CPU time on Server thread just by swapping dispatchers.<br>For some odd reason Room thread is now about 140% slower - but hey, never said it was bug free solution :P<br><br>Thiago Macieira wrote:<br><br>> The one thing to look after is that QAbstractSocket has a shortcut to skip<br>> some of the signal-slot mechanisms of QSocketNotifier and be notified<br>> immediately by way of a virtual. So there's a second place to deal with<br>> registering/unregistering, aside from QSocketNotifier.<br><br>For the love of God I can't find it. Do I understand correctly, that I should look for another place that call register / unregister SocketNotifier() directly?</div>