[issue10667] collections.Counter object in C

2010-12-15 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Fixed if( spacing and applied in r87265. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10667

[issue10667] collections.Counter object in C

2010-12-14 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Attaching a new patch for high-speed update() and __init__(). I also tried a C version of __missing__() but the speed-up was too small to be worth it. -- resolution: later - stage: - patch review versions: +Python

[issue10667] collections.Counter object in C

2010-12-14 Thread Gregory P. Smith
Gregory P. Smith g...@krypto.org added the comment: rhettinger's fastcount.patch looks good to me. a couple style nits but they're minor. no space between if and (? yuck. short variable names like it? yuck. but the code looks good otherwise. i'm all for it. -- nosy:

[issue10667] collections.Counter object in C

2010-12-10 Thread Daniel Urban
Changes by Daniel Urban urban.dani...@gmail.com: -- nosy: +durban ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10667 ___ ___ Python-bugs-list

[issue10667] collections.Counter object in C

2010-12-10 Thread Andrew Svetlov
Changes by Andrew Svetlov andrew.svet...@gmail.com: -- nosy: +asvetlov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10667 ___ ___

[issue10667] collections.Counter object in C

2010-12-10 Thread Justin Peel
Justin Peel pee...@gmail.com added the comment: I've done as Antoine asked and made a pure Python PyCounter class and a C-enhanced Counter class that both use the mixin CounterBase class. I also added to the tests so that both PyCounter and Counter are tested. I left the update_fromsubs()

[issue10667] collections.Counter object in C

2010-12-10 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: I would like this API to sit and cook for a good while. There are many possible ways to add more methods and most be end-up being YAGNI. Also, my experience with dict.fromkeys() is that a fair number of people get confused

[issue10667] collections.Counter object in C

2010-12-10 Thread Justin Peel
Justin Peel pee...@gmail.com added the comment: Okay, I was done submitting. I thought that Antoine was asking for a version that kept a pure Python version so I did that. -- ___ Python tracker rep...@bugs.python.org

[issue10667] collections.Counter object in C

2010-12-09 Thread Justin Peel
New submission from Justin Peel pee...@gmail.com: I put the Counter's update and __missing__ methods into C code. The rest of the existing methods remain the same. The new Counter is at least 2x-10x (or more) faster for updating depending on the input. I also added a new method,

[issue10667] collections.Counter object in C

2010-12-09 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: Thanks for the patch. FWIW, I'm attaching some timing code that I've used in the past. -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org

[issue10667] collections.Counter object in C

2010-12-09 Thread Raymond Hettinger
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: Added file: http://bugs.python.org/file19993/time_counter.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10667 ___

[issue10667] collections.Counter object in C

2010-12-09 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: When adding some C accelerations, we often try to keep a pure Python alternative in the stdlib, since it can then benefit other Python implementations (and easy prototyping). If you move some of the methods inside a mixin and use multiple