On Mar 1, 10:13 am, Robert Bradshaw <rober...@math.washington.edu>
wrote:
> On Tue, Mar 1, 2011 at 12:48 AM, Johan S. R. Nielsen
> See lazy-import. Doing this for everything may incur significant
> delays the first time a function is called (rather than before the
> prompt) and there are issues with Sage being fragile about the order
> in which some modules are implemented, but yes, it's possible and
> largely implemented.
>
> - Robert

i have played a bit more with lazy_import and looks promising.

On my computer, a cold start of sage is around 10 seconds.

I start a fresh session and look in the global namespace names
belonging to a module containing sage and save this information in a
pickle file

{{{
import pickle

L = copy(globals())

pepinillo = {}

for name in L:
    if hasattr(L[name], '__module__') and L[name].__module__:
        ambient_module = L[name].__module__
        if 'sage' in ambient_module:
            if pepinillo.has_key(ambient_module):
                pepinillo[ambient_module].append(name)
            else:
                pepinillo[ambient_module] = [name]

f = open('pepinillo.sobj','w')
pickle.dump(pepinillo, f)
f.close()
}}}

pepinillo.sobj is only 70K

Now, I start an ipython session and load the information of pepinillo
as lazy_objects

{{{
import pickle
L = pickle.load(open('pepinillo.sobj'))
from sage.misc.lazy_import import lazy_import

for ambient_module in L:
    for name in L[ambient_module]:
        lazy_import(ambient_module, name)
}}}

This is instantaneous less than 0.5 seconds

Now I have more or less a sage session. It is not usable, there is no
preparser. There is no working ZZ, RR or CC so most commands complain.
ZZ = Integer() produces a segfault. var('x') also segfaults.

-- 
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

Reply via email to