[PySide] QtNetwork.QSslSocket.supportsSsl()
Joel B. Mohler
JMohler at Gamry.com
Wed Oct 8 22:50:45 CEST 2014
On 10/8/2014 4:35 PM, Florian Bruhin wrote:
> * 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 :)
Right, I'm using the standard python profiler and it won't measure
inside C function calls. However, in this case that was enough to
highlight this specific code in PySide. I actually use IPython and type
"%prun import PySide". I show the output in the PS (because IPython is
extremely handy and worth illustrating!).
>> 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?
It might be the same thing in a different form. Whether or not
"supportsSsl" is legitimately taking 1 second, I don't really know (or
care). The reason I don't care is because I don't want to call it at
all, but PySide has coded it directly in the root PySide.__init__:
https://qt.gitorious.org/pyside/pyside/source/0c64d1b2c6e5e0951675ad9b22294db4a10741c7:PySide/__init__.py.in#L37
Joel
PS:
C:\> ipython
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 2.2.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: %prun import PySide
1476 function calls (1473 primitive calls) in 0.975 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.941 0.941 0.941 0.941 {supportsSsl}
1 0.018 0.018 0.018 0.018 _utils.py:91(get_pyside_dir)
1 0.007 0.007 0.975 0.975 <string>:1(<module>)
1 0.005 0.005 0.968 0.968
__init__.py:6(_setupQtDirectories)
21 0.001 0.000 0.001 0.000 {nt._isdir}
.....
More information about the PySide
mailing list