Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'causing': 0.04; 'repository': 0.05; 'git': 0.09; 'dictionary,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'subject:slow': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'appear': 0.29; 'code': 0.31; 'lines': 0.31; 'probably': 0.32; 'run': 0.32; "can't": 0.35; 'there': 0.35; 'button': 0.38; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'kind': 0.63 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Mon, 08 Sep 2014 17:51:25 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11 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> <540CADDD.3050501@riseup.net> <540CB15C.2060008@gmail.com> <540CC278.4050106@riseup.net> In-Reply-To: <540CC278.4050106@riseup.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410220299 news.xs4all.nl 2846 [2001:888:2000:d::a6]:36257 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77706 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. > > 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?