2010/3/3 William Stein <wst...@gmail.com>: > On Tue, Mar 2, 2010 at 7:56 PM, Dr. David Kirkby > <david.kir...@onetel.net> wrote: >>> Right now it takes over 1.5 seconds every time. >>> wst...@sage:~$ time sage -c "print factor(2010)" >>> 2 * 3 * 5 * 67 >>> real 0m1.535s >>> user 0m1.140s >>> sys 0m0.460s >> >> Personaly I don't find that too excessive for a large tool. How long does >> Gimp take to start? > > That's irrelevant. What matters is how long Maple, Mathematica, > Matlab, Maxima, Pari, and Magma take to start. > After repeatedly running the command on sage.math, this is how things > stabilize: > > > Pari 0.030s > Python 0.046s > Maple 0.111s > Maxima 0.456s > Mathematica 0.524s > Matlab 0.844s > Magma 0.971s > Sage 1.658s > > This is probably the only benchmark that involves a "function" that > *everybody* uses -- starting up the program. Sage is currently dead > last, and by a lot. Python and Pari are both by far the fastest to > startup, so at least it isn't Python's fault :-). > > > LOG: > > wst...@sage:~$ time echo "2+2;" | sage -python > real 0m0.046s > > wst...@sage:~$ time echo "2+2;" | magma > Magma V2.14-9 Wed Mar 3 2010 05:40:30 on sage [Seed = 2126205915] > Type ? for help. Type <Ctrl>-D to quit. > 4 > > Total time: 0.570 seconds, Total memory usage: 6.94MB > > real 0m0.971s > > -- > > wst...@sage:~$ time echo "2+2;" | maple > |\^/| Maple 12 (X86 64 LINUX) > ._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2008 > \ MAPLE / All rights reserved. Maple is a trademark of > <____ ____> Waterloo Maple Inc. > | Type ? for help. >> 2+2; > 4 > >> quit > memory used=0.8MB, alloc=0.7MB, time=0.01 > > real 0m0.111s > > --- > > wst...@sage:~$ time echo "2+2;" | math > Mathematica 6.0 for Linux x86 (64-bit) > Copyright 1988-2007 Wolfram Research, Inc. > > In[1]:= > In[2]:= > > real 0m0.524s > > > -- > > wst...@sage:~$ time echo "2+2;" | matlab > Warning: Unable to open display , MATLAB is starting without a display. > You will not be able to display graphics on the screen. > Warning: > MATLAB is starting without a display, using internal event queue. > You will not be able to display graphics on the screen. > > > < M A T L A B > > Copyright 1984-2006 The MathWorks, Inc. > Version 7.2.0.283 (R2006a) > January 27, 2006 > > > To get started, type one of these: helpwin, helpdesk, or demo. > For product information, visit www.mathworks.com. > >>> >> > real 0m0.844s > > --- > > wst...@sage:~$ time echo "2+2;" | sage -maxima > ;;; Loading #P"/home/wstein/build/production/sage/local/lib/ecl/defsystem.fas" > ;;; Loading #P"/home/wstein/build/production/sage/local/lib/ecl/cmp.fas" > ;;; Loading #P"/home/wstein/build/production/sage/local/lib/ecl/sysfun.lsp" > Maxima 5.20.1 http://maxima.sourceforge.net > using Lisp ECL 9.10.2 > Distributed under the GNU Public License. See the file COPYING. > Dedicated to the memory of William Schelter. > The function bug_report() provides bug reporting information. > (%i1) > (%o1) 4 > (%i2) > real 0m0.456s > > --- > > > wst...@sage:~$ time echo "2+2;" | sage -gp > GP/PARI CALCULATOR Version 2.3.3 (released) > amd64 running linux (x86-64/GMP-4.2.1 kernel) 64-bit version > compiled: Feb 25 2010, gcc-4.2.4 (Ubuntu 4.2.4-1ubuntu4) > (readline v6.0 enabled, extended help available) > > Copyright (C) 2000-2006 The PARI Group > > PARI/GP is free software, covered by the GNU General Public License, and > comes WITHOUT ANY WARRANTY WHATSOEVER. > > Type ? for help, \q to quit. > Type ?12 for how to get moral (and possibly technical) support. > > parisize = 8000000, primelimit = 500000 > Goodbye! > > real 0m0.030s > > --- > > wst...@sage:~$ time echo "2+2;" | sage > ---------------------------------------------------------------------- > | Sage Version 4.3.3, Release Date: 2010-02-21 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > sage: sage: > Exiting SAGE (CPU time 0m0.05s, Wall time 0m0.06s). > > real 0m1.658s
A suggestion to debug these issues is to use oprofile. A cheat sheet from a procedure I used some times in the past to debug performance of multi programs/modules/libraries is: # rm -fr /var/lib/oprofile/samples/current/; opcontrol --init; opcontrol --start; <sage-command-here>; opcontrol --dump; opcontrol --stop; opcontrol --deinit # opreport --symbols In my tests, I would run as root, have the computer as idle as possible, and also do the start/stop of oprofile logging to avoid as much as possible any noise. This of couse is Linux specific, but similar tools should exist in other OSes. An example in the current computer I am, but not logging kernel time (otherwise, need an uncompressed kernel image): $ sudo su # urpmi python-debug # opcontrol --no-vmlinux # rm -fr /var/lib/oprofile/samples/current/; opcontrol --init; opcontrol --start; echo "2+2" | sage; opcontrol --dump; opcontrol --stop; opcontrol --deinit Using default event: CPU_CLK_UNHALTED:100000:0:1:1 Using 2.6+ OProfile kernel interface. Using log file /var/lib/oprofile/samples/oprofiled.log Daemon started. Profiler running. ---------------------------------------------------------------------- | Sage Version 4.3.3, Release Date: 2010-02-21 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: 4 sage: Exiting SAGE (CPU time 0m0.05s, Wall time 0m0.05s). Stopping profiling. Killing daemon. Unloading oprofile module # opreport --symbols | head -23 samples % image name app name symbol name 13489 22.8685 no-vmlinux no-vmlinux /no-vmlinux 3195 5.4166 libpython2.6.so.1.0 libpython2.6.so.1.0 PyEval_EvalFrameEx 3099 5.2539 libpython2.6.so.1.0 libpython2.6.so.1.0 lookdict_string 1340 2.2718 libpython2.6.so.1.0 libpython2.6.so.1.0 PyDict_GetItem 1268 2.1497 libpython2.6.so.1.0 libpython2.6.so.1.0 __i686.get_pc_thunk.bx 1166 1.9768 libpython2.6.so.1.0 libpython2.6.so.1.0 PyParser_AddToken 1001 1.6970 libpython2.6.so.1.0 libpython2.6.so.1.0 visit_decref 971 1.6462 libpython2.6.so.1.0 libpython2.6.so.1.0 PyDict_Next 959 1.6258 libpython2.6.so.1.0 libpython2.6.so.1.0 visit_reachable 802 1.3597 libc-2.11.so libc-2.11.so memcpy 736 1.2478 ld-2.11.so ld-2.11.so do_lookup_x 707 1.1986 libpython2.6.so.1.0 libpython2.6.so.1.0 _PyType_Lookup 680 1.1528 libpython2.6.so.1.0 libpython2.6.so.1.0 PyObject_Malloc 644 1.0918 ld-2.11.so ld-2.11.so strcmp 595 1.0087 libpython2.6.so.1.0 libpython2.6.so.1.0 tupletraverse 588 0.9969 libpython2.6.so.1.0 libpython2.6.so.1.0 _PyString_Eq 567 0.9613 libpython2.6.so.1.0 libpython2.6.so.1.0 PyString_FromFormatV 540 0.9155 libc-2.11.so libc-2.11.so _int_malloc 531 0.9002 libpython2.6.so.1.0 libpython2.6.so.1.0 PyObject_Free 497 0.8426 bash bash /bin/bash [I needed to save this email and do a run without firefox running, because it wants at leat 10% cpu, and would polute the results from inside xulrunner] This also using mandriva sagemath rpm. I installed python-debug rpm or it would display all python timings in a single chunk... And stopped at the first bash entry. For source build, probably would need a non stripped build, other distros may have different debug package formats. Paulo -- 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 URL: http://www.sagemath.org