Skip to content

Instantly share code, notes, and snippets.

@mmalone
Created December 9, 2010 19:59
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 mmalone/735234 to your computer and use it in GitHub Desktop.
Save mmalone/735234 to your computer and use it in GitHub Desktop.
>>> x = 'abcdefghijklmnopqrstuvwyz1234567890'
>>> for i in xrange(len(x) + 1):
... y = (x[:i] + 'x' * len(x))[:len(x)]
... print timeit.Timer('x == y', 'from __main__ import x, y').timeit()
...
0.0604889392853
0.0732460021973
0.069344997406
0.0671350955963
0.0664479732513
0.065771818161
0.0661709308624
0.0657761096954
0.0661160945892
0.0660429000854
0.0657470226288
0.0665831565857
0.0667967796326
0.0681478977203
0.0657529830933
0.0659811496735
0.0728430747986
0.0684361457825
0.074590921402
0.0688810348511
0.0764408111572
0.0709269046783
0.0741410255432
0.069354057312
0.0750420093536
0.0693850517273
0.0739231109619
0.0756769180298
0.0749719142914
0.0694630146027
0.0730848312378
0.0692138671875
0.0724120140076
0.0718340873718
0.0768218040466
0.0721220970154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment