To understand the impact of failed module loads (where Python traverses sys.path looking for a module), I used the following code:
import string import random def random_string(n): return ''.join(random.choice(string.ascii_letters) for x in range(n)) def random_import(): for i in range(100): name = random_string(5)+'.'+random_string(5)+'.'+random_string(5) try: __import__(name) except ImportError: pass On geom.math: sage: %timeit random_import() 5 loops, best of 3: 175 ms per loop On my laptop: sage: %timeit random_import() 5 loops, best of 3: 47.1 ms per loop This is both times with warm cache. I also tried enabling the atime mount option on my laptop, and that did not cause any noticeable changes. I also tried some background CPU load on my laptop, and as long as I don't saturate all cores I find only minor (~10%) slowdown. So its mysterious to me why geom.math is so slow. It would would be interesting to know how geom.math benchmarks when it is completely idle, right now its at about 50% CPU load. On Saturday, August 11, 2012 2:43:36 PM UTC-4, Volker Braun wrote: > > I still don't understand why its so slow for you, on a recent machine Sage > startup with warm cache should be around 1s. > > Playing around with the startup a bit, I noticed that the notebook stuff > imports a lot during startup. Why do we need to import anything from the > notebook except the notebook() function? This seems wasteful. Cutting out > the notebook imports saves me about 1/4 of the startup time (from ~1s to > 0.75s). > > We also have a lot of stuff in the sys.path that causes many failed open() > calls upon startup as Python has to check every directory for modules. > About half of all are notebook-related python packages that have no use in > mathematics. These are also subdirectories of site-packages so they are > searched twice since site-packages is also is sys.path. Just getting rid of > packages that are only used in the notebook saves about a third of all > open() calls during startup. But on my laptop that only saves something on > the order of 0.01s, basically nothing. But if you have a slow file system > then it might make a difference. > > > > > On Friday, August 10, 2012 8:51:17 PM UTC-4, William wrote: >> >> Hi, >> >> I'm sad that on a fast SSD repeatedly doing the following: >> >> wstein@geom:/usr/local/sage/sage-5.2$ time echo "" | ./sage >> ---------------------------------------------------------------------- >> | Sage Version 5.2, Release Date: 2012-07-25 | >> | Type "notebook()" for the browser-based notebook interface. | >> | Type "help()" for help. | >> ---------------------------------------------------------------------- >> sage: sage: >> Exiting Sage (CPU time 0m0.03s, Wall time 0m0.03s). >> >> real 0m1.902s >> user 0m1.428s >> sys 0m0.424s >> >> always outputs 1.9 seconds! That test was < 1 second on sage.math >> when I put in a doctest to make sure it didn't exceed that 1 second, >> when we were trying to improve the sage startup time. In the >> intervening year (?), the test is ignored or gone, and the startup >> time seems to have got a bit worse. Dang. >> >> On another faster machine, I'm getting: >> >> wstein@combinat:/usr/local/sage/sage-5.2$ time echo "" | ./sage >> ---------------------------------------------------------------------- >> | Sage Version 5.2, Release Date: 2012-07-25 | >> | Type "notebook()" for the browser-based notebook interface. | >> | Type "help()" for help. | >> ---------------------------------------------------------------------- >> sage: sage: >> Exiting Sage (CPU time 0m0.04s, Wall time 0m0.05s). >> >> real 0m1.580s >> user 0m1.224s >> sys 0m0.356s >> >> >> Any ideas? >> >> >> >> >> William >> >> >> >> >> -- >> William Stein >> Professor of Mathematics >> University of Washington >> http://wstein.org >> > -- -- 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