Guido van Rossum <gu...@python.org> added the comment:
I had a simpler idea for an inline cache for LOAD_METHOD than GH-23503. The essential part goes like this (sorry for the hybrid C/Python): if <optimized etc.>: if type == lm->type and type->tp_version_tag == lm->tp_version_tag: meth = lm->meth SET_TOP(meth) PUSH(obj) DISPATCH() name = GETITEM(names, oparg) meth_found = _PyObject_GetMethod(obj, name, &meth) <error check> if meth_found: SET_TOP(meth) PUSH(obj) if <optimizing etc.>: lm = ... lm->type = type lm->meth = meth <etc.> What am I missing? Why is the hash of the name needed? Oh, it's probably because there could still be an overriding value in obj.__dict__. But certainly we could check for type == lm->type before the other checks (HasFeature and tp_version_tag). But what if we only did this for classes without an instance dict? That could work for things like list.append and str.find. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42115> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com