[FRPythoneers] performance of cmp()

Sean Reifschneider jafo at tummy.com
Tue Sep 23 15:57:02 MDT 2003


On Tue, Sep 23, 2003 at 02:23:04PM +0530, Rahul Kumar wrote:
>I just finished writing my first python program. I have a performance
>critical loop in which 2 strings are compared. My initial code looked
>like this:

I guess that the reason you're trying to improve the performance of this
loop is that you have already decided that it's not performing
adequately.  In other words, this isn't premature optimization...

If that's the case, have you considered trying either going down into C
or using Pyrex to see if the performance increases?  You might just be
able to do a "strcmp()" in C fairly easily, or you may be able to push
more of the code in this loop into C.  You should definitely look at
Pyrex if you have performance critical code, though.

Sean
-- 
 Sometimes it pays to stay in bed on Monday, rather than spending the rest
 of the week debugging Monday's code.  -- Christopher Thompson
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995.  Qmail, Python, SysAdmin



More information about the FRPythoneers mailing list