Teach the JIT about frozenset immutability
Created originally on Bitbucket by antocuni (Antonio Cuni)
The JIT does not take advantage of frozenset immutability. E.g. consider this case:
TUP = ('foo', 'bar', 'baz')
FROZ = frozenset(TUP)
def main():
x = 0
for i in range(2000):
x += 'foo' in TUP
x += 'foo' in FROZ
main()
The JIT can constat-fold the TUP lookup but not the FROZ one.
Looking at the code, W_FrozensetObject
lacks _immutable_fields_
, but I'm not sure whether more is needed to achieve it.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information