Skip to content

Having trouble while using pypy: pyperf is much slower than timeit #137

@wangyi041228

Description

@wangyi041228

I'm learting Python and made some tests. I downloaded and unzipped pypy to a folder. I can't find the proper way to use pyperf with pypy. Can I get the result with JIT?

Code:

# global i, big loop of empty
## pyperf
py -3.10 -m pyperf timeit -s "global i" "for i in range(100_000_000): pass" --rigorous
Mean +- std dev: 1.95 sec +- 0.04 sec

pypy -m pyperf timeit -s "global i" "for i in range(100_000_000): pass" --rigorous
Mean +- std dev: 1.02 sec +- 0.02 sec

### The command
### Can I get the result with JIT?

## timeit
py -3.10 -m timeit -s "global i" "for i in range(100_000_000): pass"
1 loop, best of 5: 2.02 sec per loop

pypy -m timeit -s "global i" "for i in range(100_000_000): pass"
5 loops, average of 7: 46 +- 1.56 msec per loop

pypy --jit off -m timeit -s "global i" "for i in range(100_000_000): pass"
1 loops, average of 7: 6.31 +- 0.0155 sec per loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions