I have test code
class T:
def __init__(self, data):
self.data = data
@profile
def main():
a = T(1)
d = T(T(1))
e = T(
T(1))
g = T(T(T(1)))
h = T(
T(
T(1)))
i = T(
T(
T(
T(1))))
main()
then I try
kernprof -l test.py
python -m line_profiler test.py.lprof
then I get
Line # Hits Time Per Hit % Time Line Contents
==============================================================
6 @profile
7 def main():
8 1 5.0 5.0 29.4 a = T(1)
9 1 2.0 2.0 11.8 d = T(T(1))
10 2 2.0 1.0 11.8 e = T(
11 1 1.0 1.0 5.9 T(1))
12 1 2.0 2.0 11.8 g = T(T(T(1)))
13 2 0.0 0.0 0.0 h = T(
14 2 0.0 0.0 0.0 T(
15 1 0.0 0.0 0.0 T(1)))
16 2 1.0 0.5 5.9 i = T(
17 2 2.0 1.0 11.8 T(
18 2 1.0 0.5 5.9 T(
19 1 1.0 1.0 5.9 T(1))))
It's seems line break will double hit and get a wrong per hit time. Is this a bug?
I have test code
then I try
then I get
It's seems line break will double hit and get a wrong per hit time. Is this a bug?