This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients corona10, rhettinger
Date 2020-07-20.23:49:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595288980.43.0.651492399818.issue41347@roundup.psfhosted.org>
In-reply-to
Content
I would rather not do this.   It optimizes for the uncommon case where all the objects are identical.  The common case is slightly worse off because the identity test is performed twice, once before the call to Py_RichCompareBool() and again inside it.  Also, the PR adds a little clutter which obscures the business logic.  

Another thought, micro-benchmarks on the identity tests require some extra care because they are super sensitive to branch prediction failures (See https://stackoverflow.com/questions/11227809 ).  A more realistic dataset would be:

  x = 12345
  data = [x] * 100 + list(range(500))
  random.shuffle(data)
  data.count(x)
History
Date User Action Args
2020-07-20 23:49:40rhettingersetrecipients: + rhettinger, corona10
2020-07-20 23:49:40rhettingersetmessageid: <1595288980.43.0.651492399818.issue41347@roundup.psfhosted.org>
2020-07-20 23:49:40rhettingerlinkissue41347 messages
2020-07-20 23:49:40rhettingercreate