[Python-Dev] talking about performance...
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Sun, 18 Jun 2000 23:42:00 +0200
amk wrote:
> On Sun, Jun 18, 2000 at 09:06:45PM +0200, Fredrik Lundh wrote:
> >so in other words, something in unicode land isn't
> >as efficient as it should...
>=20
> The relevant bit of findstring() in unicodeobject.c:
>=20
> if (direction < 0) {
> for (; end >=3D start; end--)
> if (Py_UNICODE_MATCH(self, end, substring))
> return end;
> } else {
> for (; start <=3D end; start++)
> if (Py_UNICODE_MATCH(self, start, substring))
> return start;
> }
>=20
> And...
>=20
> #define Py_UNICODE_MATCH(string, offset, substring)\
> (!memcmp((string)->str + (offset), (substring)->str,\
> (substring)->length*sizeof(Py_UNICODE)))
heh. it's my own code, of course...
> Proposed patch:
>=20
> Index: unicodeobject.c
MATCH is used in a couple of places; it's probably a better idea
to change the macro (in Include/unicodeobject.h). MAL?
</F>