Hi, I hope that this is appropriate for sage-devel, as it is technical.
As some colleagues who are new to Sagemath were asking me what I knew, I realized that I was unable to comment very sensibly on the various types of integers and of real numbers treated by Sage (no doubt because in my own research, ZZ and QQ are basically fine, as far as real numbers go). This question is bound to come up again, and I'm curious, so I'd like to find out. We are talking about very basic advice to give to a beginner, and so, I knew enough to say that well, C ints (so I guess numpy.int's) will be fast, but limited in size, and elements of ZZ can be as large as your memory allows etc (and a similar, but different, discussion with RDF (or numpy.float) and RR etc). However, I am unable to write a piece of code that would clearly show the difference in speed ! I tried naive things like setting x and y to be integers of a certain type, and then sage: %timeit x^y for example, but I always get "" The slowest run took 59.81 times longer than the fastest. This could mean that an intermediate result is being cached. "" This makes sense, but I'm not sure what else to try. Individual " %time x^y " statements seem to show no difference between ZZ and numpy.int, for example, which puzzles me (overhead?). Exact same issues when defining the factorial via fac= lambda n : 1 if n == 0 else n*fac(n-1) and trying to time fac(500): about the same with ZZ and numpy.int. I thought about multiplying large matrices, but I'm afraid that completely different algorithms/libraries will be used depending on the parent ring (say, for numpy.int it would be numpy matrix multiplication, obviously very fast), and that's no good: I would just like to emphasize the difference in speed for basic operations like + or *. Here i'm not talking about Cython: sure, I tried 'int' and 'double' in Cython code, it's blazingly fast, but that's not the question here. So here is my question: does anybody know of a basic test/piece of code that would illustrate the difference in speed between various types of integers and/or floats? thanks! Pierre -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.