Python性能分析指南(9)

发表于:2013-11-12来源:开源中国社区作者:袁不语点击数: 标签:性能测试
08 Line # Hits Time Per Hit % Time Line Contents 09 ============================================================== 10 2 @profile 11 3 def primes(n): 12 4 1 2 2.0 1.1 if n==2: 13 5 return [2] 14 6 1 1
08 Line #      Hits         Time  Per Hit   % Time  Line Contents
09 ==============================================================
10      2                                           @profile
11      3                                           def primes(n): 
12      4         1            2      2.0      1.1      if n==2:
13      5                                                   return [2]
14      6         1            1      1.0      0.5      elif n<2:
15      7                                                   return []

原文转自:http://www.oschina.net/translate/python-performance-analysis