[Python-Dev] memcmp performance

Antoine Pitrou solipsis at pitrou.net
Thu Oct 20 23:08:48 CEST 2011


Hello,

> 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.
> 
> Before I put in a tracker bug report, I wanted to present my findings
> and make sure they were repeatable to others (isn't that the nature
> of science? ;)   as well as offer discussion.

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.

Have you reported gcc's "outdated optimization" issue to them? Or is it
already solved in newer gcc versions?

Under glibc-based systems, it seems we can't go wrong with the system
memcpy function. If gcc doesn't get in the way, that is.

Regards

Antoine.




More information about the Python-Dev mailing list