Closed
Description
Consider:
class MyObject: pass
def func():
o = MyObject()
o.__dict__
for _ in range(100):
o.foo = "bar"
o.baz = "qux"
for _ in range(100):
func()
opcode[STORE_ATTR_INSTANCE_VALUE].specialization.miss : 20382
opcode[STORE_ATTR_INSTANCE_VALUE].execution_count : 21167
The STORE_ATTR_INSTANCE_VALUE
has a guard _GUARD_DORV_NO_DICT
that ensures that the object does not have a managed dictionary:
Line 2269 in 760872e
However, the specializer for STORE_ATTR_INSTANCE_VALUE
does not take that into account. It only checks that the inline values are valid:
Lines 867 to 886 in 760872e
I'm not sure if we should change the guard or change specialize.c