Hi! The ticket is #23673.
Cheers, Simon On 2017-08-22, Simon King <[email protected]> wrote: > Hi Travis, > > On 2017-08-21, [email protected] <[email protected]> wrote: >> It is in a cython file, but it is not a cpdef method. However, I think >> avoiding dict() (and using .iteritems() instead of items() because it is >> Cython [so it is still Py3 compatible]) for non-sparse polynomials is good. >> Actually, as you suggest, using the specific data structures would likely >> be a lot faster. Do you want to start work on this, which I will happily >> review, or do you want me to? > > I am not so sure whether I will tackle specific polynomial types. However, > I think I can provide a speed up of the generic implementation: Instead > of self.dict().items(), one should work with self.list(copy=False), which > is called by self.dict() anyway, thus avoiding the overhead of constructing > a dict and its items: > > sage: R.<x> = SR[] > sage: p = prod(x+i for i in range(60)) > sage: %timeit R([int(v)%123 for v in p.list(copy=False)]) > 100 loops, best of 3: 5.13 ms per loop > sage: %timeit p.map_coefficients(lambda z: int(z)%123) > 100 loops, best of 3: 11 ms per loop > > And that's in Python (= Sage command line), not Cython. > > Best regards, > Simon > -- You received this message because you are subscribed to the Google Groups "sage-release" 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 https://groups.google.com/group/sage-release. For more options, visit https://groups.google.com/d/optout.
