-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pyperf does not work in REPL #74
Comments
Different variant of same problem, now on pyperf 2.3.0. Same failure in pyperf 2.2.0. Python 3.8.10 (default, Sep 28 2021, 16:10:42)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyperf
>>> pyperf.__version__
'2.3.0'
>>> runner = pyperf.Runner()
>>> runner.timeit('sorted(nums)', stmt='sorted(nums)', setup='import random; nums = [i for i in range(0, 100)]; random.shuffle(nums)')
usage: -m pyperf
[-h]
{show,hist,compare_to,stats,metadata,check,collect_metadata,timeit,system,convert,dump,slowest,command}
...
-m pyperf: error: argument action: invalid choice: '4' (choose from 'show', 'hist', 'compare_to', 'stats', 'metadata', 'check', 'collect_metadata', 'timeit', 'system', 'convert', 'dump', 'slowest', 'command')
Error when running timeit benchmark:
Statement:
'sorted(nums)'
Setup:
'import random; nums = [i for i in range(0, 100)]; random.shuffle(nums)'
Teardown:
'pass'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyperf/_timeit.py", line 230, in bench_timeit
runner.bench_time_func(name, timer.time_func, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/pyperf/_runner.py", line 462, in bench_time_func
return self._main(task)
File "/usr/local/lib/python3.8/dist-packages/pyperf/_runner.py", line 432, in _main
bench = self._manager()
File "/usr/local/lib/python3.8/dist-packages/pyperf/_runner.py", line 560, in _manager
bench = Manager(self).create_bench()
File "/usr/local/lib/python3.8/dist-packages/pyperf/_manager.py", line 229, in create_bench
worker_bench, run = self.create_worker_bench()
File "/usr/local/lib/python3.8/dist-packages/pyperf/_manager.py", line 128, in create_worker_bench
suite = self.create_suite()
File "/usr/local/lib/python3.8/dist-packages/pyperf/_manager.py", line 118, in create_suite
suite = self.spawn_worker(self.calibrate_loops, 0)
File "/usr/local/lib/python3.8/dist-packages/pyperf/_manager.py", line 104, in spawn_worker
raise RuntimeError("%s failed with exit code %s"
RuntimeError: /usr/bin/python3 failed with exit code 2
comint-write-history-sentinel: Python exited abnormally with code 1 |
Oh right, currently, pyperf can only be used by running a script: https://pyperf.readthedocs.io/en/latest/examples.html To support REPL, Manager.worker_cmd() should be enhanced. Currently, there is a special Runner class for the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using
pyperf
2.0.0.The text was updated successfully, but these errors were encountered: