Antoine Pitrou, 20.10.2011 23:08:
I have been doing some performance experiments with memcmp, and I was
surprised that memcmp wasn't faster than it was in Python.  I did a whole,
long analysis and came up with some very simple results.

Thanks for the analysis. Non-bugfix work now happens on Python 3, where
the str type is Python 2's unicode type. Your recommendations would
have to be revisited under that light.

Well, Py3 is quite a bit different now that PEP393 is in. It appears to use memcmp() or strcmp() a lot less than before, but I think unicode_compare() should actually receive an optimisation to use a fast memcmp() if both string kinds are equal, at least when their character unit size is less than 4 (i.e. especially for ASCII strings). Funny enough, tailmatch() has such an optimisation.

Stefan

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to