[pypy-issue] [issue843] PyPy slower than CPython with puzzle problem
Justin Peel
tracker at bugs.pypy.org
Fri Aug 26 00:16:49 CEST 2011
Justin Peel <peelpy at gmail.com> added the comment:
I suggest changing the line
if not running_totals[i] & running_totals[j]:
to
if running_totals[i].isdisjoint(running_totals[j]):
With this change, both CPython and Pypy are a lot faster, but Pypy is now about
twice as fast as CPython on my computer. However, we should definitely look at
why the Pypy's set intersection method is slower in Pypy than CPython's method.
One possible cause is that Pypy's set is really just an RPython dict where the
values of the keys are set to None while CPython has a slightly different
implementation for the set as opposed to the dict which doesn't have any values
being set for the keys. It might be good to have a separate set object in
RPython.
----------
nosy: +justinpeel
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue843>
________________________________________
More information about the pypy-issue
mailing list