Re: [sage-support] arrays in Sage's cython

2013-08-22 Thread Nils Bruin
On Thursday, August 22, 2013 6:21:13 AM UTC-7, John Cremona wrote: > > Then use srange() which yields Integers. > > John > The appropriate answer should be: use xsrange, unless you explicitly need the integers as a list. The extra memory footprint of srange will probably be detrimental to perf

Re: [sage-support] arrays in Sage's cython

2013-08-22 Thread John Cremona
On 22 August 2013 14:10, Daniel Krenn wrote: > Am 2013-08-22 01:12, schrieb Robert Bradshaw: >> Using a Python list is probably the fastest way to iterate over an >> array of Python objects--it's a PyObject** under the hood and Cython >> uses the C API calls to get at it. > > Ok, thanks for the cl

Re: [sage-support] arrays in Sage's cython

2013-08-22 Thread Daniel Krenn
Am 2013-08-22 01:12, schrieb Robert Bradshaw: > Using a Python list is probably the fastest way to iterate over an > array of Python objects--it's a PyObject** under the hood and Cython > uses the C API calls to get at it. Ok, thanks for the clearification. > Your "check" might be the > bottlene

Re: [sage-support] arrays in Sage's cython

2013-08-21 Thread Robert Bradshaw
Using a Python list is probably the fastest way to iterate over an array of Python objects--it's a PyObject** under the hood and Cython uses the C API calls to get at it. Your "check" might be the bottleneck, especially if it's a Python call. Also, no need to write this as a while loop; just use "

[sage-support] arrays in Sage's cython

2013-08-21 Thread Daniel Krenn
I need an array of Elements of RealIntervalField and I want to iterate (a lot of times) through it. How can I do that in a fast way in Sage's cython (i.e. in the notebook or in a .spyx-file)? An (minimal) example what I basically want is given below (PS). I tried the following things (and a lot m