2008/9/23 William Stein <[EMAIL PROTECTED]>: > > On Mon, Sep 22, 2008 at 6:11 PM, Craig Citro <[EMAIL PROTECTED]> wrote: >> >> Hi John, >> >>> That is not in itself slow: >>> sage: time pp=pari.primes_up_to_n(10^8) >>> CPU times: user 0.69 s, sys: 0.30 s, total: 1.00 s >>> Wall time: 1.00 s >>> >>> However note that >>> >>> sage: time pp=prime_range(10^8) >>> CPU times: user 143.74 s, sys: 1.51 s, total: 145.26 s >>> Wall time: 145.93 s >>> >>> with all the extra time being spent converting pari integers to Sage ones. >>> >> >> Actually, it's not the Pari <--> Sage conversion that's slow: the list >> pp is about 6 million entries long, and even for large numbers, we >> have: >> >> sage: n = pari(10**8) >> sage: %time for _ in range(6000000): foo = ZZ(n) >> CPU times: user 4.40 s, sys: 0.03 s, total: 4.43 s >> Wall time: 4.44 s >> >> I haven't checked into all the details, but I'm pretty sure that >> what's actually going so slow is iteration over the Pari list! I just >> wrote a few lines of Cython to do this, and here is the timing for the >> same problem above, and it seems to work: >> >> sage: %time ls = my_prime_range(1,10**8) >> CPU times: user 1.99 s, sys: 0.89 s, total: 2.88 s >> Wall time: 2.89 s >> >> sage: type(ls[0]) >> <type 'sage.rings.integer.Integer'> >> sage: ls[-5:] >> [99999931, 99999941, 99999959, 99999971, 99999989] >> >> I'm about to eat dinner, but I'll get this cleaned up (and possibly >> start investigating iteration on Pari objects, if I'm right about >> that) tonight. It's shameful that we let it be that slow in the first >> place! :) > > Well, we = "me", and it's a good thing I have no shame!
None would be appropriate. You did an enormous amount in an incredibly short time way back then! Alex and I are also hoping that Craig will review our major pari precision-andling patch (#4096) soon, and this is in some ways similar (though smaller). I still don't know if this is going to help the MACOS problem with my sll_finite_field odctest though! John > > But I'm really glad you guys are fixing this. > > Regards, > William > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---