提交 cb066cf9 authored 作者: Frederic's avatar Frederic

Faster profiling by doing less toposort.

上级 79d97216
......@@ -507,13 +507,22 @@ class ProfileStats(object):
print >> file, header_str
atimes = [(
topos = {} # Only do the topo once per fct.
atimes = []
for a, t in self.apply_time.items():
if a not in topos:
topo = a.fgraph.toposort()
topos[a] = topo
else:
topo = topos[a]
atimes.append((
t * 100 / local_time,
t,
a,
a.fgraph.toposort().index(a),
self.apply_callcount[a])
for a, t in self.apply_time.items()]
topo.index(a),
self.apply_callcount[a]))
del topos
atimes.sort()
atimes.reverse()
tot = 0
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论