mirror of https://gitlab.com/ita1024/waf.git
optimization
This commit is contained in:
parent
220c438320
commit
b5c043ef49
|
@ -99,7 +99,7 @@ class Node(object):
|
|||
The Node objects are not thread safe in any way.
|
||||
"""
|
||||
|
||||
__slots__ = ('name', 'sig', 'children', 'parent', 'cache_abspath', 'cache_isdir')
|
||||
__slots__ = ('name', 'sig', 'children', 'parent', 'cache_abspath', 'cache_isdir', 'cache_sig')
|
||||
def __init__(self, name, parent):
|
||||
self.name = name
|
||||
self.parent = parent
|
||||
|
@ -788,19 +788,16 @@ class Node(object):
|
|||
Node signature, assuming the file is in the build directory
|
||||
"""
|
||||
try:
|
||||
ret = self.ctx.hash_cache[id(self)]
|
||||
except KeyError:
|
||||
pass
|
||||
return self.cache_sig
|
||||
except AttributeError:
|
||||
self.ctx.hash_cache = {}
|
||||
else:
|
||||
return ret
|
||||
pass
|
||||
|
||||
if not self.is_bld() or self.ctx.bldnode is self.ctx.srcnode:
|
||||
self.sig = Utils.h_file(self.abspath())
|
||||
self.ctx.hash_cache[id(self)] = ret = self.sig
|
||||
self.cache_sig = ret = self.sig
|
||||
return ret
|
||||
|
||||
|
||||
# TODO Waf 1.8
|
||||
search = search_node
|
||||
|
||||
|
|
Loading…
Reference in New Issue