这是我的npm install -g generator-meanjs@0.1.12
:
script.py
我安装了@profile
def primes(n):
if n == 2:
return [2]
elif n < 2:
return []
s = range(3, n + 1, 2)
mroot = n ** 0.5
half = (n + 1) / 2 - 1
i = 0
m = 3
while m <= mroot:
if s[i]:
j = (m ** 2 - 3) / 2
s[j] = 0
while j < half:
s[j] = 0
j += m
i += 1
m = 2*i + 3
return [2] + [x for x in s if x]
number = 40000
elts = primes(number)
:
line_profiler
并按如下方式运行
$ pip install line_profiler
这很奇怪......没有计时结果!
所以我调查了转储,但也没有运气:
$ kernprof -l -v script.py
Wrote profile results to profiling.py.lprof
Timer unit: 1e-06 s
我是如何使用此库错误的?