Re: [Python-Dev] str.count is slow

2006-03-12 Thread Armin Rigo
Hi Ben, On Mon, Feb 27, 2006 at 06:50:28PM -0500, Ben Cartwright wrote: > > It seems to me that str.count is awfully slow. Is there some reason > > for this? stringobject.c could do with a good clean-up. It contains very similar algorithms multiple times, in slightly different styles and with d

Re: [Python-Dev] str.count is slow

2006-02-28 Thread Greg Ewing
Guido van Rossum wrote: > Recent versions of GCC appear > to be implementing C98 by default -- at least I didn't get complaints > about declarations placed after non-declarations in the same block > from any of the buildbot hosts... As long as it doesn't complain when I *do* put all my declaratio

Re: [Python-Dev] str.count is slow

2006-02-28 Thread Bill Janssen
> As for the question of whether to switch to C++ in 3.0, I'd say > probably not, as it's much harder to interface with C++ from other > languages than to C. An excellent point, and to my mind conclusive. Bill ___ Python-Dev mailing list Python-Dev@

Re: [Python-Dev] str.count is slow

2006-02-28 Thread James Y Knight
On Feb 28, 2006, at 6:14 PM, Guido van Rossum wrote: > On 2/28/06, Greg Ewing <[EMAIL PROTECTED]> wrote: >> Fredrik Lundh wrote: >> My personal goal in life right now is to stay as far away from C++ as I can get. >>> >>> so what C compiler are you using ? >> >> Gcc, mostly. I don't mind

Re: [Python-Dev] str.count is slow

2006-02-28 Thread Guido van Rossum
On 2/28/06, Greg Ewing <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > > > My personal goal in life right now is to stay as > > > far away from C++ as I can get. > > > > so what C compiler are you using ? > > Gcc, mostly. I don't mind if it's capable of > compiling C++, as long as I can choos

Re: [Python-Dev] str.count is slow

2006-02-28 Thread Greg Ewing
Fredrik Lundh wrote: > > My personal goal in life right now is to stay as > > far away from C++ as I can get. > > so what C compiler are you using ? Gcc, mostly. I don't mind if it's capable of compiling C++, as long as I can choose not to write any. -- Greg Ewing, Computer Science Dept, +

Re: [Python-Dev] str.count is slow

2006-02-27 Thread Fredrik Lundh
Greg Ewing wrote: > Fredrik Lundh wrote: > > > moving to (basic) C++ might also be a good idea (in 3.0, perhaps). is any- > > one still stuck with pure C89 these days ? > > Some of us actually *prefer* working with plain C > when we have a choice, and don't consider ourselves > "stuck" with it.

Re: [Python-Dev] str.count is slow

2006-02-27 Thread Greg Ewing
Fredrik Lundh wrote: > moving to (basic) C++ might also be a good idea (in 3.0, perhaps). is any- > one still stuck with pure C89 these days ? Some of us actually *prefer* working with plain C when we have a choice, and don't consider ourselves "stuck" with it. My personal goal in life right no

Re: [Python-Dev] str.count is slow

2006-02-27 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > > it's about time that someone sat down and merged the string and unicode > > implementations into a single "stringlib" code base (see the SRE sources for > > an efficient way to do this in plain C). [1] > [...] > > 1) anyone want me to start working on this ? > > This w

Re: [Python-Dev] str.count is slow

2006-02-27 Thread martin
Zitat von Fredrik Lundh <[EMAIL PROTECTED]>: > it's about time that someone sat down and merged the string and unicode > implementations into a single "stringlib" code base (see the SRE sources for > an efficient way to do this in plain C). [1] [...] > 1) anyone want me to start working on this ?

Re: [Python-Dev] str.count is slow

2006-02-27 Thread Fredrik Lundh
(manually cross-posting from comp.lang.python) Ben Cartwright wrote: > Your evidence points to some unoptimized code in the underlying C > implementation of Python. As such, this should probably go to the > python-dev list (http://mail.python.org/mailman/listinfo/python-dev). > This tactic typi

Re: [Python-Dev] str.count is slow

2006-02-27 Thread Ben Cartwright
>From comp.lang.python: [EMAIL PROTECTED] wrote: > It seems to me that str.count is awfully slow. Is there some reason > for this? > Evidence: > > str.count time test > import string > import time > import array > > s = string.printable * int(1e5) # 10**7 character string > a = a