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


Groups > comp.lang.python > #51466

Re: collections.Counter surprisingly slow

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.089
X-Spam-Evidence '*H*': 0.83; '*S*': 0.01; 'constructor': 0.09; 'subject:skip:c 10': 0.09; '(both': 0.16; 'defaultdict': 0.16; 'mro': 0.16; 'subject:slow': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'helper': 0.24; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; 'especially': 0.30; 'message-id:@mail.gmail.com': 0.30; 'extend': 0.32; 'but': 0.35; 'received:google.com': 0.35; 'method': 0.36; 'to:addr :python-list': 0.38; 'expect': 0.39; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'even': 0.60; 'first': 0.61; 'taking': 0.65; 'account': 0.65; 'jul': 0.74; '3.4': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=J3OVZmGJt52WP3E2uvMpq9jhbw7ko2vh9X5uE2ULe6Q=; b=e4wszTy49mMpopUUNRohUqte2Z8wk3raCamrliMwPSFyZWdf7jh5Eyo8hzudx86L9n fsLje9V++xBEpksD97C0uBW2tca1RyfpsqPdpjBk81etJmZ+bbRncaWNCg0JotQHSuk3 EIPwZWtpeHtxxkumh52X2iJi5eH1ni/hrSGYB7sIiC383kSZhf9jE4w+IZg+DHByZPIw bc4tiPUEmXxLbQXXMqH+nk0PKRWa+dJbssEhAWDmc8CFWYJvPuOQePWGlVkHs6K8pxRa 6e58UJBrZ1R0mrq5vt7BRGYKH1hiqmBj3606sBH5jrAeuJRvMvZb6XzrfEfRZD9YyI6m 94lQ==
X-Received by 10.66.228.38 with SMTP id sf6mr9056440pac.21.1375118402245; Mon, 29 Jul 2013 10:20:02 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAN1F8qU9o3Wm43VX0hPXSeYPWY4U73c+xp3q35Z3g664SiZJhA@mail.gmail.com>
References <roy-8C60F5.15590428072013@news.panix.com> <kt51t3$r61$1@ger.gmane.org> <CAN1F8qU9o3Wm43VX0hPXSeYPWY4U73c+xp3q35Z3g664SiZJhA@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Mon, 29 Jul 2013 11:19:22 -0600
Subject Re: collections.Counter surprisingly slow
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5249.1375118411.3114.python-list@python.org> (permalink)
Lines 9
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1375118411 news.xs4all.nl 15984 [2001:888:2000:d::a6]:43332
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:51466

Show key headers only | View raw


On Mon, Jul 29, 2013 at 5:49 AM, Joshua Landau <joshua@landau.ws> wrote:
> Also, couldn't Counter just extend from defaultdict?

It could, but I expect the C helper function in 3.4 will be faster
since it doesn't even need to call __missing__ in the first place.
And the cost (both in terms of maintenance and run-time) of adding
defaultdict to the Counter MRO just to reuse one tiny __missing__
method seems questionable, especially after taking into account that
the constructor signature is incompatible.

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


Thread

collections.Counter surprisingly slow Roy Smith <roy@panix.com> - 2013-07-28 15:59 -0400
  Re: collections.Counter surprisingly slow Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-28 20:51 +0000
    Re: collections.Counter surprisingly slow Roy Smith <roy@panix.com> - 2013-07-28 17:57 -0400
    Re: collections.Counter surprisingly slow Stefan Behnel <stefan_ml@behnel.de> - 2013-07-29 13:46 +0200
    Re: collections.Counter surprisingly slow Joshua Landau <joshua@landau.ws> - 2013-07-29 13:07 +0100
  Re: collections.Counter surprisingly slow Serhiy Storchaka <storchaka@gmail.com> - 2013-07-29 09:25 +0300
  Re: collections.Counter surprisingly slow Joshua Landau <joshua@landau.ws> - 2013-07-29 12:49 +0100
  Re: collections.Counter surprisingly slow Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-29 11:19 -0600
  Re: collections.Counter surprisingly slow Serhiy Storchaka <storchaka@gmail.com> - 2013-07-29 22:37 +0300
  Re: collections.Counter surprisingly slow Stefan Behnel <stefan_ml@behnel.de> - 2013-07-30 08:39 +0200
  Re: collections.Counter surprisingly slow Stefan Behnel <stefan_ml@behnel.de> - 2013-07-30 08:51 +0200
  Re: collections.Counter surprisingly slow Serhiy Storchaka <storchaka@gmail.com> - 2013-07-30 16:04 +0300

csiph-web