Message75940
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. |
|
Date |
User |
Action |
Args |
2008-11-16 15:13:32 | rhettinger | set | recipients:
+ rhettinger, pitrou |
2008-11-16 15:13:32 | rhettinger | set | messageid: <1226848412.62.0.980605366134.issue3106@psf.upfronthosting.co.za> |
2008-11-16 15:13:32 | rhettinger | link | issue3106 messages |
2008-11-16 15:13:31 | rhettinger | create | |
|