A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-May/014926.html below:

[Python-Dev] Comparison speed

[Python-Dev] Comparison speedMartin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sun, 20 May 2001 15:48:43 +0200
> string_compare() could special-case pointer equality too, although I suspect
> doing so would be a net loss.

I've done some measurements here, too, again taking your example

from time import clock

indices = [1] * 1000000

def doit():
    s = clock()
    for i in indices:
        "ab" < "ab"
    f = clock()
    return f - s

for i in xrange(10):
    print "%.3f" % doit()

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.

Now, looking at the case of non-identical pointers, I could not find
any measurable difference. After increasing the number of rounds by a
factor of ten, I got, without identity test

6.920
6.920
6.910
6.970
7.080
6.920
6.920
6.910
6.930
6.920

With identity test, I got

6.930
6.930
6.920
7.080
6.920
6.930
6.960
6.930
6.920
6.920

That still does not look like a significant difference to me.

Regards,
Martin



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4