Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'cpython': 0.05; 'correct.': 0.07; 'lookup': 0.09; 'cc:addr:python-list': 0.11; 'algorithmic': 0.16; 'dictionary,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lookups': 0.16; "object's": 0.16; 'ought': 0.16; 'subject:slow': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'equivalent.': 0.31; 'sep': 0.31; 'figure': 0.32; 'implemented': 0.33; 'but': 0.35; 'received:google.com': 0.35; "you're": 0.61; 'yes': 0.68; 'complexity': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=+1Bw/XnB0zdU2e7REP/xVemDQZq2uStRWB4wHcZJOdo=; b=pW1ocvonRejp085PCRHQEtCc9QeU/L5wdxw4vHnEC/hXmARXEAXalpr5r6wPg7Su9n vQSFa3JuQ2Xcr8PaAl5dAjHrDUHE1xqNdGSF606irPohNXLyHPKfAmCEgeRvkDA4ZyuH R2NnHAdPlvALmcGEmo1KqCgIcP8qM9Un9aApfeJinDByAFuIk4KJMt730lf/TzdGRV/f nBi6vGdPOEcrMOgErDSV8xX5rLYJEOP9fHBYkVN8GfcPt8hNOjbMpzm/jaATRLl2vfcm L9cv6f0Rmas3qU9CLUNXEgZLWhJ5DFSMhgNuZ8mYb+NU6ravgc1gBSow3/7Cu7yNAY9k y1pQ== MIME-Version: 1.0 X-Received: by 10.50.80.76 with SMTP id p12mr33090861igx.34.1410277021305; Tue, 09 Sep 2014 08:37:01 -0700 (PDT) In-Reply-To: <540F1D83.1010602@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> Date: Wed, 10 Sep 2014 01:37:01 +1000 Subject: Re: weakref, memory management and execution slow down in PyQt4 From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1410277030 news.xs4all.nl 2892 [2001:888:2000:d::a6]:43030 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77742 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). ChrisA