[Python-Dev] Comparison speed

Tim Peters tim.one@home.com
Sun, 20 May 2001 17:13:04 -0400


[Martin v. Loewis, on pointer-equality tests in string_compare()]

> I've done some measurements here, too, again taking your example
> ...
>     for i in indices:
>         "ab" < "ab"
> ...
> This is the case where testing for identity helps. Running it without
> identity test takes 0.74s, running it with identity test takes 0.68s.

This stuff all ties together.  A pointer-equality test in string_compare() is
guaranteed to lose every time string_compare() gets called from
lookdict_string().  Let's lose string_compare() entirely (in favor of a
self-contained-- apart from memcmp() --string_richcompare).