The only incompatibility is the `.copy()` calls which should be replaced by `list(contents)`, then it'll be cross-compatible between P2 and P3.
Here's what I get with that (on a 2010 MBP) using the random generation of lgas above (1M random ints):
> time python2.7 qs.py
python2.7 qs.py 41.92s user 0.37s system 98% cpu 42.837 total
> time python3.6 qs.py
python3.6 qs.py 42.99s user 0.32s system 98% cpu 44.047 total
> time pypy qs.py
pypy qs.py 3.27s user 0.12s system 94% cpu 3.603 total
There's a fair bit of variation but pypy is between 3.4 and 4
The only incompatibility is the `.copy()` calls which should be replaced by `list(contents)`, then it'll be cross-compatible between P2 and P3.
Here's what I get with that (on a 2010 MBP) using the random generation of lgas above (1M random ints):
There's a fair bit of variation but pypy is between 3.4 and 4