Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77710

Re: weakref, memory management and execution slow down in PyQt4

Date 2014-09-09 02:45 +0000
From kjs <bfb@riseup.net>
Subject Re: weakref, memory management and execution slow down in PyQt4
References (1 earlier) <loom.20140907T152314-538@post.gmane.org> <540CADDD.3050501@riseup.net> <540CB15C.2060008@gmail.com> <540CC278.4050106@riseup.net> <540E40FD.8030706@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.13884.1410230734.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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.

Thanks,
Kevin

[0] http://www.kaggle.com/c/seizure-prediction/data

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: weakref, memory management and execution slow down in PyQt4 kjs <bfb@riseup.net> - 2014-09-09 02:45 +0000

csiph-web