New submission from Brian Kearns <[email protected]>:

for list, performance looks not that different:
$ ./pypy/goal/pypy-c -m timeit -s "a = 'abc'" "'abc' in ('123', '456', 'abc', 
'def')"
1000000000 loops, best of 3: 0.00107 usec per loop
$ ./pypy/goal/pypy-c -m timeit -s "a = 'abc'" "a in ('123', '456', 'abc', 
'def')"
100000000 loops, best of 3: 0.00292 usec per loop

for set:
$ ./pypy/goal/pypy-c -m timeit -s "a = 'abc'" "'abc' in {'123', '456', 'abc', 
'def'}"
1000000000 loops, best of 3: 0.00107 usec per loop
$ ./pypy/goal/pypy-c -m timeit -s "a = 'abc'" "a in {'123', '456', 'abc', 
'def'}"
10000000 loops, best of 3: 0.025 usec per loop

looks like in the last case an optimization that is applied to list is not 
applied to set?

----------
messages: 5521
nosy: bdk, pypy-issue
priority: performance bug
status: unread
title: missed optimization on set contains

________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1436>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to