Ticket #45 (reopened enhancement)
Inefficient comparison code generation
| Reported by: | gfurnish | Owned by: | somebody |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Optimization | Keywords: | |
| Cc: |
Description
Consider the following code:
if left._name==(<SymbolicVariable_class>right)._name:
Which generates:
__pyx_2 = PyObject_RichCompare(__pyx_v_left->__pyx_base._name, ((struct _\
_pyx_obj_4sage_9symbolics_14variable_class_SymbolicVariable_class *)__pyx_v_rig\
ht)->__pyx_base._name, Py_EQ); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_\
f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1;}
__pyx_1 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_1 < 0)) {__p\
yx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __\
pyx_L1;}
Is there a reason we don't use the
int PyObject_RichCompareBool( PyObject *o1, PyObject *o2, int opid)
functionality in python to avoid the extra python boolean step?
Change History
Note: See
TracTickets for help on using
tickets.
