On Mon, Mar 8, 2010 at 4:46 PM, Maciej Fijalkowski <fij...@gmail.com> wrote: > On Mon, Mar 8, 2010 at 5:37 PM, Ondrej Certik <ond...@certik.cz> wrote: >> On Mon, Mar 8, 2010 at 4:32 PM, Maciej Fijalkowski <fij...@gmail.com> wrote: >>>> >>>> Try divisors() from sympy/ntheory/factor_.py. I tried that with Cython >>>> (pure Python mode, so that you have the same source code, that works >>>> both in Python and in Cython) and I forgot which speedup I got, but at >>>> least 10x, maybe up to 25x. Should be in the archives of this list. >>>> >>>> Ondrej >>>> >>> >>> On pure integers like this:: >>> >>> divisors(10000000) >>> >>> times on my test machine are 1.12s for cpython, 0.091 for pypy (that's >>> 12x speedup). >>> >>> on divisors(Integer(10000000)) speedups are less impressive (5s for >>> CPython, 3s for PyPy). >>> >>> Which one did you try on Cython? >> >> Here are all the details: >> >> http://groups.google.com/group/sympy/browse_thread/thread/4eaf42ba165a2fed/b0948473d159cd50 >> >> (the google groups are currently down..., but it will be back up >> hopefully later today) >> >> Ondrej >> > > It's back up again. > > So yeah, you can get 12x speedup without providing type feedback and > pxd file :-) Missing 2x comes from the fact that cython (and gcc) can > detect loop constants and a couple of inefficiencies in pypy
You actually need to tell Cython the loop constant. Otherwise Cython just speeds things up by 1.5x. > implementation (which are porting simple optimizations from gcc). Could pypy be ever as fast as Cython, e.g. 23x speedup? By hinting pypy that the loop variable is an integer. Ondrej -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sy...@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.