Skip to content

Instantly share code, notes, and snippets.

@jefftriplett
Created September 13, 2012 15:53
Show Gist options
  • Select an option

  • Save jefftriplett/3715280 to your computer and use it in GitHub Desktop.

Select an option

Save jefftriplett/3715280 to your computer and use it in GitHub Desktop.
Perfect example of why my boss is an asshole. An optimizingly correct and performance tuned asshole.
# example from: http://stackoverflow.com/questions/68630/are-tuples-more-efficient-than-lists-in-python
$ python -m timeit "x=(1,2,3,4,5,6,7,8)"
10000000 loops, best of 3: 0.0571 usec per loop
$ python -m timeit "x=[1,2,3,4,5,6,7,8]"
1000000 loops, best of 3: 0.254 usec per loop
$ python -m timeit -s "x=(1,2,3,4,5,6,7,8)" "y=x[3]"
10000000 loops, best of 3: 0.0758 usec per loop
$ python -m timeit -s "x=[1,2,3,4,5,6,7,8]" "y=x[3]"
10000000 loops, best of 3: 0.097 usec per loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment