#17435: Cythonise path algebra elements
-------------------------------------+-------------------------------------
Reporter: SimonKing | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.8
Component: algebra | Resolution:
Keywords: path algebra | Merged in:
elements, days64.5, days65 | Reviewers:
Authors: Simon King | Work issues:
Report Upstream: N/A | Commit:
Branch: | 0b9ecbc6c54d6a00f5d35cd9c2ce7ff00c9ab84c
public/17435/cythonise_path_algebra_elements| Stopgaps:
Dependencies: #16453 #17526 |
-------------------------------------+-------------------------------------
Comment (by SimonKing):
Concerning "inline", I read in several sources that inline should be done
on SMALL functions that are called OFTEN.
But I am not sure what is small. I guess what counts here is the size of
the C-code generated by Cython. For example, I removed the "inline" from
bitset_init, because I expected that the error handling bloats the C-code,
and because I thought that bitset_init is called less often than bitset
manipulation functions. The C-code is
{{{
#!C
static int __pyx_f_4sage_15data_structures_6bitset_bitset_init(struct
__pyx_t_4sage_15data_structures_6bitset_bitset_s *__pyx_v_bits,
mp_bitcnt_t __pyx_v_size) {
int __pyx_r;
__Pyx_RefNannyDeclarations
int __pyx_t_1;
PyObject *__pyx_t_2 = NULL;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("bitset_init", 0);
__pyx_t_1 = ((__pyx_v_size <= 0) != 0);
if (__pyx_t_1) {
__pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError,
__pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename =
__pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto
__pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_2);
__Pyx_Raise(__pyx_t_2, 0, 0, 0);
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno =
__LINE__; goto __pyx_L1_error;}
}
__pyx_v_bits->size = __pyx_v_size;
__pyx_v_bits->limbs = (((__pyx_v_size - 1) / (8 * (sizeof(mp_limb_t))))
+ 1);
__pyx_v_bits->bits = ((mp_limb_t *)sage_calloc(__pyx_v_bits->limbs,
(sizeof(mp_limb_t))));
__pyx_t_1 = ((__pyx_v_bits->bits == NULL) != 0);
if (__pyx_t_1) {
PyErr_NoMemory(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85;
__pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
}}}
Is that "long"? I think so. Thus, better not inline.
--
Ticket URL: <http://trac.sagemath.org/ticket/17435#comment:133>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.