Re: [sage-devel] overhead in creating p-adic elements

2010-08-26 Thread David Roe
So, I have a patch up at #9814 which improves the situation. One thing to note is that addition actually puts off the mpz_remove until later: the x you obtain from x = y + z has "x._normalized = False," so that repeated additions don't require multiple mpz_removes. You can argue with this design

Re: [sage-devel] overhead in creating p-adic elements

2010-08-13 Thread David Roe
So, I haven't looked at profiling for p-adics for quite a while. But one way to speed up this kind of item creation is to implement a morphism from ZZ to Qp and then write a super-fast _call_ method. I can't do it right now, but I can provide advice if someone else wants to. David On Fri, Aug 13

[sage-devel] overhead in creating p-adic elements

2010-08-13 Thread David Harvey
Hi, sage: K = Qp(13, 5) sage: 13^5 371293 sage: y = K(10) sage: z = K(20) sage: timeit("x = y * z") 625 loops, best of 3: 961 ns per loop # varies a bit but this is typical sage: timeit("x = y + z") 625 loops, best of 3: 942 ns per loop # ditto That's the cost of arithmetic. Pret