optimize sparql.Bindings by FlorianLudwig · Pull Request #1192 · RDFLib/rdflib (original) (raw)
This improves performance 13% on the rdflib-benchmark with the default (memory) store and a store size of 4k.
Moving straight to collections.ChainMap
was considered but
Bindings
behaves differently when one key is in multiple dicts, as they are iterated over multiple times and also counted on__len__
multiple times- The API is a bit different, increasing the changes size
I do think that the differences for __len__
and __iter__
are unintentional / bugs. If so, I would rework this MR to fix those.