weakref, memory management and execution slow down in PyQt4

kjs bfb at riseup.net
Tue Sep 9 04:45:03 CEST 2014

Thanks for the consideration Michael. If you do get the data, and are
able to run the code, let me know if you notice anything interesting.

Michael Torrie:
> On 09/07/2014 02:39 PM, kjs wrote:
>> The code is minimal[0]. The only other widgets are a start button that
>> fires off the plotting and a stop button that calls sys.exit().
> Unfortunately there are no data files in your git repository so I can't
> run it.

The data is available from the internet[0] in the form of 3+GB gziped
blobs. In case you don't want to register an account with Kaggle and
download 3GB to execute the code, I have uploaded a sample file to a
Tahoe LAFS grid accessible via tor. If you're interested in downloading
the data, please let me know and I'll share the read capability with
you. Additionally, I should write some tests the use mock data. I'll let
you know if I get around to this.

>> Lines 112-114 appear to be causing the weakref proliferation.
> Is there a reason you are using setattr and getattr instead of a proper
> data structure?  both of those calls are rather expensive.  Would
> probably be cheaper to use some kind of array, dictionary, or other
> purpose-built data structure?

You're right, a dictionary can do everything I need and more. This
happened to be the first thing I thought of, and I didn't imagine it
would be very expensive. I figured it was simply a different way of
defining and retrieving a class variable. IE setattr(self, foo, True) ==
self.foo = True.


[0] http://www.kaggle.com/c/seizure-prediction/data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x8A61431E.asc
Type: application/pgp-keys
Size: 11239 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20140909/529a4af1/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20140909/529a4af1/attachment.sig>

More information about the Python-list mailing list