Skip to content

Instantly share code, notes, and snippets.

@blakev
Last active October 6, 2017 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blakev/250633fb7a8d148c6594684c097f13cb to your computer and use it in GitHub Desktop.
Save blakev/250633fb7a8d148c6594684c097f13cb to your computer and use it in GitHub Desktop.
import timeit
print(timeit.Timer("'+'.join([str(x) for x in range(10000)])").repeat(3, 1000))
print(timeit.Timer("'+'.join(map(str, range(10000)))").repeat(3, 1000))
# [1.843802978983149, 1.838354193023406, 1.8291272450005636]
# [1.4447947760345414, 1.442527316045016, 1.4384180280612782]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment