Author serhiy.storchaka
Recipients pitrou, python-dev, rhettinger, serhiy.storchaka
Date 2015-02-02.19:18:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1422904692.51.0.471288231302.issue23359@psf.upfronthosting.co.za>
In-reply-to
Content
May be the code can be simplified without affecting performance if remove slower "else" branch in set_lookkey and set_insert_clean. At least I didn't find a regression in microbenchmarks, but found small benefit.

For example:

$ ./python -m timeit -s "n = 10**6; s = set(range(n, n+10)); a = list(range(n, n+10))*10**4" -- "s.intersection(a)"

Before 0b3bc51341aa: 10 loops, best of 3: 26.6 msec per loop
After 0b3bc51341aa: 10 loops, best of 3: 25.4 msec per loop
With set_simpler_linear_probes.patch: 10 loops, best of 3: 23.9 msec per loop

$ ./python -m timeit -s "n = 10**6; s = set(range(n, n+100)); a = list(range(n, n+100))*10**3" -- "s.intersection(a)"

Before 0b3bc51341aa: 10 loops, best of 3: 26.3 msec per loop
After 0b3bc51341aa: 10 loops, best of 3: 25.3 msec per loop
With set_simpler_linear_probes.patch: 10 loops, best of 3: 23.3 msec per loop

$ ./python -m timeit -s "n = 10**6; s = set(range(n, n+10)); a = list(range(n, n+10**5))" -- "s.intersection(a)"

Before 0b3bc51341aa: 100 loops, best of 3: 12 msec per loop
After 0b3bc51341aa: 100 loops, best of 3: 11.3 msec per loop
With set_simpler_linear_probes.patch: 100 loops, best of 3: 11.4 msec per loop
History
Date User Action Args
2015-02-02 19:18:12serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, pitrou, python-dev
2015-02-02 19:18:12serhiy.storchakasetmessageid: <1422904692.51.0.471288231302.issue23359@psf.upfronthosting.co.za>
2015-02-02 19:18:12serhiy.storchakalinkissue23359 messages
2015-02-02 19:18:12serhiy.storchakacreate