Skip to content

Instantly share code, notes, and snippets.

@abunsen
Forked from igorgue/gist:1023132
Created June 13, 2011 16:39
Show Gist options
  • Save abunsen/1023137 to your computer and use it in GitHub Desktop.
Save abunsen/1023137 to your computer and use it in GitHub Desktop.
dev:~ austonbunsen$ python -mtimeit -c "lol = 'win';'i am a {0}er'.format(lol);"
1000000 loops, best of 3: 0.72 usec per loop
dev:~ austonbunsen$ python -mtimeit -c "lol = 'win'; ''.join(['i am a ', lol]);"
1000000 loops, best of 3: 0.58 usec per loop
dev:~ austonbunsen$ python -mtimeit -c "lol = 'win'; 'i am a %ser' % lol;"
1000000 loops, best of 3: 0.39 usec per loop
dev:~ austonbunsen$ python -mtimeit -c "lol = 'win'; 'i am a '+ lol +'er'"
1000000 loops, best of 3: 0.26 usec per loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment