Skip to content

Instantly share code, notes, and snippets.

@wilig
wilig / gist:3940455
Created October 23, 2012 18:14
Python Import Speed Tests
# Wanted to test the penalty for using imports inside functions.
import timeit
def t1():
return 2 * 2
timeit.timeit("t1()", setup="from __main__ import t1")
#> 0.14718103408813477