Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.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.008 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(at': 0.04; 'accelerator': 0.09; 'constructor': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:skip:c 10': 0.09; 'commented': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:slow': 0.16; 'wrote:': 0.18; 'import': 0.22; 'header:User-Agent:1': 0.23; 'helper': 0.24; 'mon,': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; "i'm": 0.30; 'extend': 0.32; 'but': 0.35; '8bit%:86': 0.38; 'to:addr:python-list': 0.38; 'expect': 0.39; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'ian': 0.60; 'first': 0.61; 'jul': 0.74; '3.4': 0.84; 'surprised,': 0.84; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Serhiy Storchaka Subject: Re: collections.Counter surprisingly slow Date: Mon, 29 Jul 2013 22:37:51 +0300 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: 37.19.137.81 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 In-Reply-To: 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: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375126808 news.xs4all.nl 15972 [2001:888:2000:d::a6]:52933 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51480 29.07.13 20:19, Ian Kelly написав(ла): > On Mon, Jul 29, 2013 at 5:49 AM, Joshua Landau 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. I'm surprised, but the Counter constructor with commented out import of this accelerator is faster (at least for some data).