Author serhiy.storchaka
Recipients rhettinger, serhiy.storchaka, tim.peters, wbolster
Date 2017-07-14.05:00:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1500008457.6.0.632724647423.issue30907@psf.upfronthosting.co.za>
In-reply-to
Content
First, few comments about the code.

1) The condition "a == b" is enough. No need to test "PyDict_CheckExact(a)" and like.

2) This fast path can be used only for Py_EQ and Py_NE. For other operations it can change the behavior.

This is common approach of implementing operator== on C++. Unless comparing objects is trivial the implementation of operator== almost always starts with comparing pointers. In Python the overhead of calling methods and comparing objects is larger than in C++ and I expect that the relative overhead of one additional pointer comparison is smaller.
History
Date User Action Args
2017-07-14 05:00:57serhiy.storchakasetrecipients: + serhiy.storchaka, tim.peters, rhettinger, wbolster
2017-07-14 05:00:57serhiy.storchakasetmessageid: <1500008457.6.0.632724647423.issue30907@psf.upfronthosting.co.za>
2017-07-14 05:00:57serhiy.storchakalinkissue30907 messages
2017-07-14 05:00:57serhiy.storchakacreate