mirror of https://github.com/commaai/tinygrad.git
perf: faster element deletion during matching (#4882)
* perf: faster deletion * fix: leave the tuple init
This commit is contained in:
parent
0eebb8e998
commit
794fecf8e3
|
@ -269,8 +269,10 @@ class UOpGraph:
|
|||
changed += recurse_cnt
|
||||
# NOTE: this changes UOp, so we have to delete caches
|
||||
up.vin = tuple(rewrite(x) for x in up.vin)
|
||||
if hasattr(up, "parents"): del up.parents
|
||||
if hasattr(up, "cmp_tuple"): del up.cmp_tuple
|
||||
try: del up.parents
|
||||
except AttributeError: pass
|
||||
try: del up.cmp_tuple
|
||||
except AttributeError: pass
|
||||
# replace with cached nodes
|
||||
if found:=self.nodes.get(key:=up.tuple()): return found
|
||||
self.nodes[key] = up
|
||||
|
|
Loading…
Reference in New Issue