robertwb / issues-import-test

0 stars 0 forks source link

Casting is slow because of TypeCheck Call #69

Closed robertwb closed 8 years ago

robertwb commented 8 years ago

Reported by gfurnish on 2 Aug 2008 12:12 UTC For instance, consider:

 149:                 top = (<SymbolicPowArithmetic>x)._operands[       __pyx_1 = __Pyx_GetItemInt(((PyObject *)((struct __pyx_obj_4sage_9symbolics_9operators_10arithmetic_SymbolicPowArithmetic *)__pyx_v_x)->__pyx_base.__pyx_base.__pyx_base._operands), 1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0](1]

); __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1;}
        if (!(__Pyx_TypeTest(__pyx_1, __pyx_ptype_4sage_9symbolics_10expression_TypedSymbolicExpression))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1;}
        Py_DECREF(((PyObject *)__pyx_v_top));
        __pyx_v_top = ((struct __pyx_obj_4sage_9symbolics_10expression_TypedSymbolicExpression *)__pyx_1);
        __pyx_1 = 0;

There needs to be a way to cast without the Py_TypeCheck call inside of the cast. I spend more time in sage-symbolics in TypeChecks then actually computing things. This is a critical problem, because in almost all cases I know that I can bypass this check.

Migrated-From: http://trac.cython.org/ticket/37

robertwb commented 8 years ago

Comment by anonymous on 2 Aug 2008 12:35 UTC Nevermind, this is me (misreading) the source code. Sorry