Feature or enhancement
I think it's probably worthwhile to write a specialized version of match_keys (for structural pattern matching of mappings) for exact dictionary types
Pitch
The most common mapping type is almost certainly the built-in dict. The match_keys function in ceval.c could be specialized to handle this type. Doing so would allow you to skip the dummy object, and replace the get call with PyDict_GetItemWithError. I don't think this should change the observable behaviour at all for exact dict
I'm in the process of reimplementing structural pattern matching on Cython, and this change gives ~2x optimization of some microbenchmarks.
If this change is deemed desirable I'm happy to implement it myself.
Previous discussion
Not aware of any
Feature or enhancement
I think it's probably worthwhile to write a specialized version of
match_keys(for structural pattern matching of mappings) for exact dictionary typesPitch
The most common mapping type is almost certainly the built-in
dict. Thematch_keysfunction in ceval.c could be specialized to handle this type. Doing so would allow you to skip the dummyobject, and replace thegetcall withPyDict_GetItemWithError. I don't think this should change the observable behaviour at all for exactdictI'm in the process of reimplementing structural pattern matching on Cython, and this change gives ~2x optimization of some microbenchmarks.
If this change is deemed desirable I'm happy to implement it myself.
Previous discussion
Not aware of any