[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Attempting to reduce the memory footprint of my PyQt5 application
From:       David Boddie <david () boddie ! org ! uk>
Date:       2016-09-06 23:03:30
Message-ID: 201609070103.30832.david () boddie ! org ! uk
[Download RAW message or body]

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.

> Assuming my memory reduction theory is right, is there any way that I can
> get the UIC and RCC generators to behave like the Qt5 Designer?  There's
> probably no point in using this strategy throughout the rest of my code if
> not.

I don't think there's a strategy to use.

You could check to see that you're not importing modules that you don't use.
Otherwise, I'm not sure if I can give you any general memory-saving tips.
Perhaps others can offer some advice here.

David
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic