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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.139.MISMATCH!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bfb@riseup.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.021
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'causing': 0.04; 'repository': 0.05; 'received:198': 0.07; '[0]': 0.09; 'git': 0.09; 'grid': 0.09; 'true)': 0.09; 'dictionary,': 0.16; 'filename:fname piece:signature': 0.16; 'foo,': 0.16; 'michael.': 0.16; 'retrieving': 0.16; 'subject:slow': 0.16; 'variable.': 0.16; 'thanks,': 0.17; 'wrote:': 0.18; 'received:10.0.1': 0.19; 'code,': 0.22; 'tests': 0.22; 'header:In-Reply-To:1': 0.27; 'appear': 0.29; 'michael': 0.29; 'kevin': 0.30; 'code': 0.31; 'lines': 0.31; 'file': 0.32; 'class': 0.32; 'this.': 0.32; 'probably': 0.32; 'run': 0.32; "can't": 0.35; 'there': 0.35; 'accessible': 0.36; 'data,': 0.36; "didn't": 0.36; 'thanks': 0.36; "i'll": 0.36; 'received:10.0': 0.36; 'should': 0.36; 'received:10': 0.37; 'button': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'rather': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'read': 0.60; 'simply': 0.61; "you're": 0.61; 'first': 0.61; 'you.': 0.62; 'kind': 0.63; 'different': 0.65; 'account': 0.65; 'sample': 0.67; 'url:c': 0.67; 'capability': 0.84; 'mock': 0.84; 'imagine': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1410230726; bh=rWgyQz35ZDGYNn50rJq0vhsBxQ97KqhC8jCUJpOPsHw=; h=Date:From:To:Subject:References:In-Reply-To:From; b=EGzzMvxZX58N2JR6/noZU5uNH6YYgVXPTjUnpl1gKhzPOvuW1Y/Y2dSfczoBHLR5k cByKgLaw4a6EikmISyZoaAyjaZ2N1fSv9qdwKpP1Utrlc2UCraUACgNJOtDJ6l7uYU QXfQeiM5K4aprBKYO8p5lh9AD7inBlgtPURlssZw=
Date Tue, 09 Sep 2014 02:45:03 +0000
From kjs <bfb@riseup.net>
MIME-Version 1.0
To python-list@python.org
Subject Re: weakref, memory management and execution slow down in PyQt4
References <540BFE43.5030006@riseup.net> <loom.20140907T152314-538@post.gmane.org> <540CADDD.3050501@riseup.net> <540CB15C.2060008@gmail.com> <540CC278.4050106@riseup.net> <540E40FD.8030706@gmail.com>
In-Reply-To <540E40FD.8030706@gmail.com>
Content-Type multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Fgww1pd9mn5Vv657aCQBsmmUifxFAQVjR"
X-Virus-Scanned clamav-milter 0.98.4 at mx1
X-Virus-Status Clean
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13884.1410230734.18130.python-list@python.org> (permalink)
Lines 264
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1410230734 news.xs4all.nl 2957 [2001:888:2000:d::a6]:60185
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77710

Show key headers only | 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