forked from M-Labs/artiq
1
0
Fork 0

compiler.types: replace isinstance() with .__class__==.

This provides a 50% speedup.
This commit is contained in:
whitequark 2015-11-27 18:22:55 +08:00
parent 6122fd70ca
commit 237e983770
1 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ class TVar(Type):
# because paths resulting from unification of large arrays # because paths resulting from unification of large arrays
# can easily cause a stack overflow. # can easily cause a stack overflow.
root = self root = self
while isinstance(root, TVar): while root.__class__ == TVar:
if root is root.parent: if root is root.parent:
break break
else: else:
@ -72,7 +72,7 @@ class TVar(Type):
# path compression # path compression
iter = self iter = self
while isinstance(iter, TVar): while iter.__class__ == TVar:
if iter is iter.parent: if iter is iter.parent:
break break
else: else: