On Jun 7, 2010, at 8:04 AM, Rolandb wrote:

Hi,

Using cython, I want to make optimal use of static data. The reason is
that lookup is (often) much faster than recalulating. I now use:

cdef list nice_list_name=[3 , 3 , 3 , 3 , 3 , 3 , 4 , 4 , 4 , 4 , 4 ,
4 , 4 , 4 , 4 , 5 , 5 , 5 , et cetera]

But this didn't increase the speed. Suggestions are appriciated!

Perhaps in your case lookup isn't faster than recalculating? If it's about a tie, re-calculating is probably better, as it's less of a "black box." Here you're using a Python list of ints, if you really want speed you'd want to use a int*. You could globally calculate this the first time it's used and use a lookup from then on.

- Robert

--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to