Created
November 19, 2012 09:45
-
-
Save mahmoud/4109868 to your computer and use it in GitHub Desktop.
partial() performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#super basic | |
$ python -m timeit -s 'def inc(x=1): return x+1' 'inc()' | |
10000000 loops, best of 3: 0.0785 usec per loop | |
$ python -m timeit -s "from functools import partial | |
> def inc(x=1): return x+1 | |
> inc = partial(inc, 1)" 'inc()' | |
10000000 loops, best of 3: 0.0922 usec per loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment