[Python-Dev] talking about performance...
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Wed, 21 Jun 2000 09:58:06 +0200
tim wrote:
> > p =3D memchr(s, sub[0], e - s);
> > if (p =3D=3D NULL)
> > break;
> > if (n =3D=3D 1 || memcmp(p, sub, n) =3D=3D 0)
> > return (long) (p - s);
> I expect that whether this is faster or slower depends on both the =
compiler
> you're using and the exact strings you're using to time it.
With test strings that contain false matches for every single
position, it's 30% slower than the old code in my tests. With
test strings that contain no false matches, it's 50% faster.
But without more extensive tests on a variety of platforms, we
might as well forget about this one...
</F>