ASKSAGE: Sage Q&A Forum  Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 23 Oct 2010 00:16:20 0500Speedup commonly used Sage functions?http://ask.sagemath.org/question/7740/speedupcommonlyusedsagefunctions/Hi,
Sage has many nice shorthand functions. This makes programming easy (to read, to debug).
But it comes with a price! For instance:
def test1():
for k in xmrange([100]*3): return k
def test2():
for k1 in xrange(100):
for k2 in xrange(100):
for k3 in xrange(100):
return [k1,k2,k3]
timeit('test1()')
timeit('test2()')
>>625 loops, best of 3: 45.9 µs per loop
>>625 loops, best of 3: 1.59 µs per loop
Four questions:

 Can we inform users that "it comes with a price?"
 Can we speed up common, often used functions (easily)?
 For more advanced users, can we provide them with a Cython equivalent?
(named for instance cxmrange)
 Maybe there is a better approach I'm not aware of?rolandSat, 23 Oct 2010 00:16:20 0500http://ask.sagemath.org/question/7740/