pyxmpp2 icon indicating copy to clipboard operation
pyxmpp2 copied to clipboard

GLibMainLoop unreasonably slow

Open Jajcus opened this issue 13 years ago • 1 comments

The pyxmpp2.test.streambase tests for the GLibMainLoop are much slower then the tests for other loop implementations:

[jajcus@lolek pyxmpp2]$ time python -m pyxmpp2.test.streambase TestInitiatorSelect
.....
----------------------------------------------------------------------
Ran 5 tests in 1.330s

OK

real    0m1.677s
user    0m0.347s
sys 0m0.030s
[jajcus@lolek pyxmpp2]$ time python -m pyxmpp2.test.streambase TestInitiatorThreaded
.....
----------------------------------------------------------------------
Ran 5 tests in 2.929s

OK

real    0m3.287s
user    0m0.383s
sys 0m0.027s
[jajcus@lolek pyxmpp2]$ time python -m pyxmpp2.test.streambase TestInitiatorGLib
.....
----------------------------------------------------------------------
Ran 5 tests in 4.193s

OK

real    0m4.539s
user    0m0.353s
sys 0m0.030s

What is interesting, the code runs considerably faster when debugging is enabled:

test_connect_close (**main**.TestInitiatorGLib) ... DEBUG:pyxmpp2.mainloop.events: dispatching...
[...]
DEBUG:pyxmpp2.mainloop.glib:..main_context_default().iteration() exited
ok

---

Ran 5 tests in 1.475s

OK

real    0m1.819s
user    0m0.387s
sys 0m0.033s

…which only makes the debugging harder.

Jajcus avatar Jul 19 '11 17:07 Jajcus

This was also the root cause of issue #60

Jajcus avatar Jul 19 '11 17:07 Jajcus