Skip to content

Instantly share code, notes, and snippets.

@igorgue
Created June 13, 2011 16:38
Show Gist options
  • Save igorgue/1023132 to your computer and use it in GitHub Desktop.
Save igorgue/1023132 to your computer and use it in GitHub Desktop.
☁ ~ python -mtimeit -c "lol = 'win'; ''.join(['i am a ', lol])"
1000000 loops, best of 3: 0.466 usec per loop
☁ ~ python -mtimeit -c "lol = 'win'; 'i am a %s' % lol"
1000000 loops, best of 3: 0.309 usec per loop
☁ ~ python -mtimeit -c "lol = 'win'; 'i am a {0}'.format(lol)"
1000000 loops, best of 3: 0.541 usec per loop
☁ ~ python -mtimeit -c "lol = 'win'; 'i am a ' + lol"
10000000 loops, best of 3: 0.21 usec per loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment