Skip to content

Instantly share code, notes, and snippets.

@kgriffs
Created August 8, 2013 17:29
Show Gist options
  • Save kgriffs/6186749 to your computer and use it in GitHub Desktop.
Save kgriffs/6186749 to your computer and use it in GitHub Desktop.
Exploring the cost of defining a noop function inline, vs. calling a free noop function. Tested on a MPB Retina, Python 2.7

Exploring the cost of defining a noop function inline, vs. calling a free noop function:

In [215]: %timeit test_inline()
1000000 loops, best of 3: 261 ns per loop

In [216]: %timeit test_external()
1000000 loops, best of 3: 215 ns per loop

In [217]: %timeit y.test_inline()
1000000 loops, best of 3: 306 ns per loop

In [218]: %timeit y.test_external()
1000000 loops, best of 3: 267 ns per loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment