Opened 4 years ago

Last modified 4 years ago

#4932 defect new

PortableGtkReactor I/O significantly slower than other common reactors

Reported by: detly Owned by:
Priority: normal Milestone:
Component: core Keywords: gtk2reactor gtk windows
Cc: Branch:
Author: Launchpad Bug:

Description

"Slower under Windows" means both:

  • slower than the select reactor or win32 reactor under Windows
  • slower than the select reactor or gtk2reactor under Linux

To observe the problem, do the following under Windows (I used XP):

  1. Run echoserv.py (it will listen on port 31415)
  2. Run echotest.py - it will use the default reactor, and should run in less than a second
  3. Uncomment lines 70-71, so that echotest.py uses the gtk2reactor
  4. Run echotest.py
  5. The script now takes 110s to run

This kind of slowdown might not be noticed when using a protocol that can just send a large chunk of data and await a small response, but the echotest.py script reflects common usage of serial communications (serial as in, RS232 connected devices): back-and-forth messaging over a long-lived protocol.

That it takes so much longer under Windows means that it is effectively impossible to have a Twisted/GTK application do any kind of fine-grained communication, serial or otherwise. In my actual application, this turned what was previously a 3 minute transfer (using threads and blocking calls) into a 25 hour transfer.

Attachments (3)

echoserv.py (595 bytes) - added by detly 4 years ago.
Echo server
echotest.py (1.9 KB) - added by detly 4 years ago.
Communications test
echotest_portable.py (1.9 KB) - added by detly 4 years ago.

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by detly

Echo server

Changed 4 years ago by detly

Communications test

comment:1 Changed 4 years ago by detly

  • Summary changed from gtk2reactor I/O significantly slower under Windows to PortableGtkReactor I/O significantly slower than other common reactors

Okay, problem can be reproduced under Linux by using portableInstall, as per the attachment. So the problem is really that the PortableGtkReactor is significantly slower (than the combinations in the original description), no matter what the platform.

Changed 4 years ago by detly

comment:2 Changed 4 years ago by detly

It all seems to come down to the way "simulate()" works in PortableGtkReactor: changing that magic "1010" factor changes the slowness, with almost perfect linearity (ie. 2020 -> twice as long, 505 -> half as long). However, setting it to zero maxes out the CPU (but comms are nice and fast!).

I get the feeling this has been discussed before, but all I could find was ticket #1759: eliminate "portable" gtk2 reactor on win32 platforms, use real gtk2 reactor.

comment:3 Changed 4 years ago by detly

Note: See TracTickets for help on using tickets.