fork(3) download
  1. import timeit
  2.  
  3. setup = '''
  4. '''
  5.  
  6. print (timeit.Timer('a="12345"; x=a.__len__()', setup=setup).repeat(10))
  7. print (timeit.Timer('a="12345"; x=len(a)', setup=setup).repeat(10))
Success #stdin #stdout 3.43s 9440KB
stdin
Standard input is empty
stdout
[0.20584988594055176, 0.20575594902038574, 0.20540904998779297, 0.20512890815734863, 0.20546293258666992, 0.2057640552520752, 0.20578694343566895, 0.20577192306518555, 0.20531415939331055, 0.2056739330291748]
[0.13330793380737305, 0.13356995582580566, 0.13353300094604492, 0.13341093063354492, 0.13366198539733887, 0.13348603248596191, 0.13337111473083496, 0.13343000411987305, 0.13348698616027832, 0.1335771083831787]