Avoid a duplicative calculation to improve the cross-referencer's performance.

This commit is contained in:
Eric S. Raymond 2009-10-31 11:10:11 +00:00
parent 15a4e86a55
commit bf36440ece
2 changed files with 6 additions and 1 deletions

View file

@ -332,11 +332,13 @@ class CrossRef:
self.noxref = False
self.properties = {}
self.unit_ids = {}
all_in = []
ignoreflag = False
conditionalsflag = False
if warnlevel >=2:
print "*** Beginning definition-gathering pass..."
for (namespace, filename) in self.filelist.generator():
all_in.append((namespace, filename))
if warnlevel > 1:
print filename + ":"
if isresource(filename):
@ -482,7 +484,7 @@ class CrossRef:
formals = []
if warnlevel >=2:
print "*** Beginning reference-gathering pass..."
for (ns, fn) in self.filelist.generator():
for (ns, fn) in all_in:
if iswml(fn):
rfp = open(fn)
attack_name = None

View file

@ -427,7 +427,10 @@ Usage: macroscope [options] dirpath
print "# Wmlscope reporting on %s" % time.ctime()
print "# Invocation: %s" % " ".join(sys.argv)
print "# Working directory: %s" % os.getcwd()
starttime = time.time()
xref = CrossRefLister(dirpath, "|".join(exclude), warnlevel)
if not extracthelp:
print "#Cross-reference time: %d seconds" % (time.time()-starttime)
if extracthelp:
xref.extracthelp(dirpath[0], sys.stdout)
elif unchecked: