Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed1.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'cpython': 0.05; 'correct.': 0.07; 'received:198': 0.07; 'lookup': 0.09; 'solution,': 0.09; '>on': 0.16; 'agree.': 0.16; 'algorithmic': 0.16; 'dict': 0.16; 'dictionary,': 0.16; 'garbage': 0.16; 'lookups': 0.16; "object's": 0.16; 'ought': 0.16; 'runtime.': 0.16; 'subject:slow': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'received:10.0.1': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'function': 0.29; 'michael': 0.29; 'chris': 0.29; 'am,': 0.29; 'related': 0.29; "i'm": 0.30; 'towards': 0.31; 'equivalent.': 0.31; 'overhead': 0.31; 'sep': 0.31; 'probably': 0.32; 'figure': 0.32; "we're": 0.32; 'call.': 0.33; 'guess': 0.33; 'but': 0.35; 'curious': 0.36; 'in.': 0.36; 'library.': 0.36; "i'll": 0.36; 'received:10.0': 0.36; 'effort': 0.37; 'list': 0.37; 'received:10': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'little': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'is.': 0.60; "you're": 0.61; 'back': 0.62; 'to:addr:gmail.com': 0.65; 'minutes': 0.67; 'believe': 0.68; 'yes': 0.68; 'complexity': 0.84; 'faster.': 0.84; 'isolated': 0.84; 'lean': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1410283732; bh=HeptPJT86BG05K9QQPARkhwpt7lTXnk4sYa53E2D5vU=; h=In-Reply-To:References:Subject:From:Date:To:From; b=Wt7dZ+qLRfmz/VpQ90/Yf0ZF44aRsaCoK9nwv1sSYvjrjCLCbQmnJmc08U4Ngbn55 PXolZx/2nRQmqiO2P7SQlJhou3P3mmH0RaOOk9Lf/hmfYUnIfAxBrXK7dNmf1Apux+ QJhfVotq62nY42XJngZQeFuUuJ4ULyRZlB1zrVbg= User-Agent: K-9 Mail for Android In-Reply-To: <540F234E.1080901@gmail.com> References: <540BFE43.5030006@riseup.net> <540CADDD.3050501@riseup.net> <540CB15C.2060008@gmail.com> <540CC278.4050106@riseup.net> <540E40FD.8030706@gmail.com> <540E69AF.5040309@riseup.net> <540F1D83.1010602@gmail.com> <540F234E.1080901@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: weakref, memory management and execution slow down in PyQt4 From: kjs Date: Tue, 09 Sep 2014 10:28:50 -0700 To: Michael Torrie ,python-list@python.org 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410283736 news.xs4all.nl 2872 [2001:888:2000:d::a6]:46727 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77746 On September 9, 2014 8:57:02 AM PDT, Michael Torrie wrote: >On 09/09/2014 09:37 AM, Chris Angelico wrote: >> On Wed, Sep 10, 2014 at 1:32 AM, Michael Torrie >wrote: >>> Yes you're correct. It is the equivalent. But it always involves >>> lookup in the object's dictionary, which is big O order O(n log n) >>> complexity for each and every access. >> >> Where do you get that figure from? A CPython dictionary is >implemented >> as a hashtable, so algorithmic complexity of lookups ought to be >O(1). > >You're right, it is. My mistake. Guess the main issue is the overhead >of an additional function call. A dict directly or a list directly may >me faster. > >Anyway, I guess we're wandering in the weeds a bit as the original >issue >is probably not related to his unorthodox choice of metaprogramming as >a >data model. I agree. I believe I have isolated the issue to be either my user of pyqtgraph, or is implementation. I lean towards the my use, because I know how little effort I put into understanding the library. If I figure on a solution, I'll be sure to come back in. I'm also curious why the weakrefs are not being garbage collected. And how many (~20,000) tiny little things can bring processing to a halt after only a couple minutes of runtime.