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


Groups > comp.lang.python > #77744

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!zen.net.uk!dedekind.zen.co.uk!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <torriem+gmail@torriefamily.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'cpython': 0.05; 'correct.': 0.07; 'lookup': 0.09; 'algorithmic': 0.16; 'dict': 0.16; 'dictionary,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'lookups': 0.16; "object's": 0.16; 'ought': 0.16; 'subject:slow': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'header:User-Agent:1': 0.23; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'michael': 0.29; 'chris': 0.29; 'am,': 0.29; 'related': 0.29; '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; 'implemented': 0.33; 'but': 0.35; 'list': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr :python-list': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'is.': 0.60; "you're": 0.61; 'yes': 0.68; 'complexity': 0.84; 'faster.': 0.84
X-Virus-Scanned amavisd-new at torriefamily.org
Date Tue, 09 Sep 2014 09:57:02 -0600
From Michael Torrie <torriem@gmail.com>
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> <loom.20140907T152314-538@post.gmane.org> <540CADDD.3050501@riseup.net> <540CB15C.2060008@gmail.com> <540CC278.4050106@riseup.net> <540E40FD.8030706@gmail.com> <540E69AF.5040309@riseup.net> <540F1D83.1010602@gmail.com> <CAPTjJmrRn0mK1CA33R0JSi9ZGM9ULf5Hv7yNmugvaxe77UmByQ@mail.gmail.com>
In-Reply-To <CAPTjJmrRn0mK1CA33R0JSi9ZGM9ULf5Hv7yNmugvaxe77UmByQ@mail.gmail.com>
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 <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.13909.1410278232.18130.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1410278232 news.xs4all.nl 2829 [2001:888:2000:d::a6]:52779
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77744

Show key headers only | View raw


On 09/09/2014 09:37 AM, Chris Angelico wrote:
> On Wed, Sep 10, 2014 at 1:32 AM, Michael Torrie <torriem@gmail.com> 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.

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


Thread

Re: weakref, memory management and execution slow down in PyQt4 Michael Torrie <torriem@gmail.com> - 2014-09-09 09:57 -0600

csiph-web