Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77750
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'skip:[ 20': 0.04; 'appropriate.': 0.09; 'lookup': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.12; 'dictionary.': 0.16; 'doubles': 0.16; 'morning,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:slow': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header :User-Agent:1': 0.23; "aren't": 0.24; 'task': 0.26; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'michael': 0.29; 'am,': 0.29; 'array': 0.29; 'probably': 0.32; 'wrong': 0.37; 'list': 0.37; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'received:71': 0.39; 'structure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; "you're": 0.61; 'more': 0.64; 'received:fios.verizon.net': 0.84; 'directly.': 0.95 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: weakref, memory management and execution slow down in PyQt4 |
| Date | Tue, 09 Sep 2014 22:15:15 -0400 |
| 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> <540F1E16.5060003@gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-71-175-90-87.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| In-Reply-To | <540F1E16.5060003@gmail.com> |
| 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.13914.1410315349.18130.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1410315349 news.xs4all.nl 2848 [2001:888:2000:d::a6]:46248 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:77750 |
Show key headers only | View raw
On 9/9/2014 11:34 AM, Michael Torrie wrote:
> On 09/08/2014 08:45 PM, kjs wrote:
>> You're right, a dictionary can do everything I need and more.
>
> Actually I am wrong in suggesting a dictionary. A list or an array
> would probably be more appropriate.
>
> Thinking about it this morning, one additional reason why getattr and
> setattr aren't appropriate for this task is that they are not just a
> dictionary lookup under the hood, they are an additional layer. One
> more function call that would be unnecessary if you used a data
> structure directly.
The extra function call for getattr at least doubles the lookup time
>>> repeat("C.a", "class C: a=1")
[0.06093001107618079, 0.042186288111423664, 0.04218598069616064]
>>> repeat("getattr(C, 'a')", "class C: a=1")
[0.13152054655972734, 0.1100451316336688, 0.11021882125309901]
--
Terry Jan Reedy
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: weakref, memory management and execution slow down in PyQt4 Terry Reedy <tjreedy@udel.edu> - 2014-09-09 22:15 -0400
csiph-web