Raymond Hettinger <[EMAIL PROTECTED]> added the comment:
You may get better timings if you more the types-are-equal test inside
the types-i-know test. Instead of:
+ if (Py_TYPE(v) == Py_TYPE(w)) {
+ if (PyLong_CheckExact(v)) {
+ if (v == w)
+ break;
+ return PyLong_RichCompare(v, w, op);
+ }
+ if (PyUnicode_CheckExact(v)) {
Do something like:
+ if (PyLong_CheckExact(v)) {
+ if (Py_TYPE(v) == Py_TYPE(w)) {
+ if (v == w)
+ break;
+ return PyLong_RichCompare(v, w, op);
+ }
+ if (PyUnicode_CheckExact(v)) {
+ if (Py_TYPE(v) == Py_TYPE(w)) {
In general, I'm not too keen on adding this kind of dispatch code to
ceval.c. It saves the time spent in PyObject_RichCompare() trying to
figure out where to delegate the work. But it comes at the expense of
weighing down ALL of the other comparisons which haven't gotten a
short-cut specialization.
_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3106>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com