On Sun, Aug 23, 2009 at 11:38 PM, Nils Bruin<nbr...@sfu.ca> wrote: > > On Aug 23, 8:15 pm, William Stein <wst...@gmail.com> wrote: > >> On sage.math (Linux) I get the same timing as you: > > That's good, because that's where I did it. > > A sage with the ecl library interface is available in "/scratch/nbruin/ > sage-4.1.1-ecl-x86_64-Linux" so if you want to do timings for > yourself, you can. > > The slowing down has nothing to do with the sage interface, but > probably with the macro #$...$ > > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 157 µs per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 197 µs per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 265 µs per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 347 µs per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 450 µs per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 611 µs per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 840 µs per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 995 µs per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 1.23 ms per loop > sage: timeit("libadd(1,2)") > 625 loops, best of 3: 1.42 ms per loop > sage: timeit("libadd(1,2)") > 125 loops, best of 3: 1.54 ms per loop
OK, that is very valuable to know. It means that independent of Sage, just evaluating the same expression "1+2" in Maxima repeatedly quickly leads to dramatic slowdowns. This seems to me like an absolutely huge bug in Maxima. I did another test. I created a file with the lines elapsed_run_time(); elapsed_run_time(); elapsed_run_time(); elapsed_run_time(); elapsed_run_time(); elapsed_run_time(); repeated many times. sage: s = 'elapsed_run_time();\n'*100000 sage: open('in','w').write(s) Then I did ./sage -maxima < in > out Finally I looked at out. At the beginning we have: (%i1) (%o1) 0.06 (%i2) (%o2) 0.06 (%i3) ... (%i31) (%o31) 0.07 I.e., it takes 30 input lines until the time counter goes from 0.06 to 0.07. Later in the file we have: (%o35147) 107.03 (%i35148) (%o35148) 107.04 (%i35149) (%o35149) 107.05 (%i35150) (%o35150) 107.06 I.e., now Maxima is 30 times slower than it was before. I wonder -- if Maxima's basic arithmetic -- e.g., simplifying 1+2 -- is super slow for some abstract reason, I wonder if it is taking longer and longer to compute the next prompt number. That would be pretty funny. Is there any way to turn off the prompt numbers? Help! What is going on!? -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---