[PyQt] Attempting to reduce the memory footprint of my PyQt5 application
Florian Bruhin
me at the-compiler.org
Wed Sep 7 06:37:27 BST 2016
* David Boddie <david at boddie.org.uk> [2016-09-07 01:03:30 +0200]:
> On Tue Sep 6 05:22:29 BST 2016, Xavion wrote:
>
> > I'm trying to cut down on the memory usage of my PyQt5 application. I'm
> > assuming that one way to do this is to only import the Qt submodules that
> > are actually used.
> >
> > The three attached files illustrate my point. The Qt5 Designer only
> > imports the necessary submodules (e.g. "QtCore/QVariant"). Whereas, the
> > PyQt5 UIC and RCC generators import the parent modules in full (e.g.
> > "QtCore").
>
> In PyQt, unless I'm mistaken, you get the whole module when you import a
> class from it so there's no way to just import the classes you use. There
> may be some tricks done to save memory at run-time but you will already be
> benefiting from those.
Correct - not only in PyQt, but in Python in general. Basically,
"from foo import bar" is equivalent to:
import foo
bar = foo.bar
del foo
Florian
--
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
GPG: 916E B0C8 FD55 A072 | 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: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160907/44c33464/attachment.sig>
More information about the PyQt
mailing list