[PySide] QtNetwork.QSslSocket.supportsSsl()

Florian Bruhin me at the-compiler.org
Wed Oct 8 22:35:57 CEST 2014


* Joel B. Mohler <JMohler at Gamry.com> [2014-10-08 13:32:37 -0400]:
> I just found an annoying bit in PySide.__init__ while examining 
> application start-up time.

Sorry for the (slight) offtopic, but how do you measure this? All the
profilers I've checked so far don't profile what happens inside Qt and
the mainloop when Python isn't involved. I'd be glad if there is some
way to do this :)

> On my windows 7 32 bit machine, the call to
> QtNetwork.QSslSocket.supportsSsl() takes almost exactly 1 second.    

With my PyQt applications, I *sometimes* have a similiar delay when
initializing the QNetworkAccessManager the first time. Maybe this is
the same issue?

I thought it happens more when I have a slow network connection (I
always notice it when I'm in a bus) but some experiments and wireshark
dumps seem to tell me it's not actually doing any network stuff.

My bugreport: https://github.com/The-Compiler/qutebrowser/issues/147

> This seems inappropriate to me to force that call at that location since 
> it takes that long.  Many applications would be conceivable that don't 
> use QtNetwork at all or ssl but they all need to pay that cost.

Is this a Qt or a PySide(/PyQt?) issue?

> A related point is that I might want to use QSplashScreen but the most 
> basic PySide import already imposes this 1-second delay.  That partly 
> defeats the purpose of the splash screen.

You probably (just a wild guess though) can import QSplashScreen
without importing anything QtNetwork related. Then you'd just have to
adjust your imports so the splashscreen gets shown before everthing
else is reported.

There also seem some approaches to lazily import stuff when it is
first used, I tracked some ideas here:

https://github.com/The-Compiler/qutebrowser/issues/153

Florian

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
             GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20141008/5807894c/attachment.sig>


More information about the PySide mailing list