[pypy-issue] Issue #2569: Teach the JIT about frozenset immutability (pypy/pypy)

Antonio Cuni issues-reply at bitbucket.org
Fri Jun 2 12:25:01 EDT 2017

New issue 2569: Teach the JIT about frozenset immutability

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


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.

More information about the pypy-issue mailing list