Skip to content
This repository has been archived by the owner on Aug 24, 2020. It is now read-only.

timeit-profile #22

Closed
sublee opened this issue Apr 22, 2015 · 1 comment
Closed

timeit-profile #22

sublee opened this issue Apr 22, 2015 · 1 comment

Comments

@sublee
Copy link
Contributor

sublee commented Apr 22, 2015

We use timeit to compare performance of similar code:

$ python -m timeit -s 'import foo' 'foo.egg()'
10000 loops, best of 3: 25.2 usec per loop
$ python -m timeit -s 'import foo' 'foo.spam()'
10000 loops, best of 3: 40.3 usec per loop

Now we know foo.spam() is slower. But why?

profiling should provide timeit as a command. It will be helpful to inquire into the cause of the performance loss.

$ python -m profiling timeit -s 'import foo' 'foo.spam()'
            ^^^^^^^^^
           Just add it.
@sublee
Copy link
Contributor Author

sublee commented Apr 24, 2015

Implemented at 9c5c5b3.

@sublee sublee closed this as completed Apr 24, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant