Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary imports cause slower sage startup #10220

Closed
jasongrout opened this issue Nov 5, 2010 · 15 comments
Closed

Unnecessary imports cause slower sage startup #10220

jasongrout opened this issue Nov 5, 2010 · 15 comments

Comments

@jasongrout
Copy link
Member

This ticket takes care of some unnecessary imports that were done at startup time instead of inside of functions. It takes care of some of the worst offenders when sage -startuptime is run.

CC: @robertwb @mwhansen

Component: performance

Keywords: import startuptime

Author: Jason Grout

Reviewer: Jeroen Demeyer

Merged: sage-4.6.1.alpha3

Issue created by migration from https://trac.sagemath.org/ticket/10220

@jasongrout
Copy link
Member Author

Attachment: trac-10220-speedup.patch.gz

@jasongrout
Copy link
Member Author

comment:1

I haven't run full doctests yet, so I guess this is needs work right now. I think it's good to go, though, modulo running doctests.

@mwhansen
Copy link
Contributor

mwhansen commented Nov 5, 2010

comment:2

What is the actual speedup?

@jdemeyer
Copy link

Reviewer: Jeroen Demeyer

@jdemeyer
Copy link

comment:3

Works for me.

@mwhansen
Copy link
Contributor

comment:4

What is the actual speedup?

@jdemeyer
Copy link

comment:5

Replying to @mwhansen:

What is the actual speedup?

Statistically insignificant...

@jdemeyer jdemeyer added this to the sage-4.6.1 milestone Nov 26, 2010
@robertwb
Copy link
Contributor

comment:6

To really speed stuff up you have to eliminate all imports of a module. Easier said than done.

@mwhansen
Copy link
Contributor

comment:7

Replying to @robertwb:

To really speed stuff up you have to eliminate all imports of a module. Easier said than done.

For example, #6494

@jdemeyer
Copy link

jdemeyer commented Dec 2, 2010

comment:8

Should this be merged if it doesn't change the startuptime?

@jdemeyer jdemeyer removed this from the sage-4.6.1 milestone Dec 2, 2010
@jasongrout
Copy link
Member Author

comment:9

I agree with both robertwb and jdemeyer. When I test it, startup doesn't seem to go down significantly, though the top one or two entries from sage -startup are eliminated.

I think the patch is helpful, but maybe doesn't go far enough to eliminate all imports of a package.

This is interesting, since this patch eliminates the imports with a - next to them in my list of slowest imports in sage -startup. However, the overall startup time does not seem to diminish appreciably. I suppose other modules take the "-" places below so that startuptime doesn't really go down? Or is it that the modules are loaded anyway somewhere else, and loading a module a second time (even in a different module) is insignificant?

sage.all: 1.608 (None)


1.608 sage.all (None)
0.387 sage.schemes.all (sage.all)
0.279 elliptic_curves.all (sage.schemes.all)
0.275 ell_rational_field (elliptic_curves.all)
0.245 ell_number_field (ell_rational_field)
0.244 sage.misc.all (sage.all)
0.243 ell_field (ell_number_field)
0.242 ell_curve_isogeny (ell_field)
0.190 sage.modular.all (sage.all)
0.151 twisted.persisted.styles (sage.all)
0.146 abvar.all (sage.modular.all)
0.145 abvar_newform (abvar.all)
0.141 abvar (abvar_newform)
0.135 sage.groups.all (abvar)
0.124 perm_gps.all (sage.groups.all)
-0.122 cubegroup (perm_gps.all)
0.117 sage.rings.all (sage.all)
-0.113 sage.plot.all (cubegroup)
0.111 sage.symbolic.pynac (sage.all)
0.106 hyperelliptic_curves.all (sage.schemes.all)
0.105 sage_input (sage.misc.all)
-0.104 sage.misc.functional (sage_input)
-0.098 complex_plot (sage.plot.all)
-0.097 numpy (complex_plot)
0.096 sage.schemes.generic.all (hyperelliptic_curves.all)
0.090 fano_toric_variety (sage.schemes.generic.all)
0.088 sage.geometry.all (fano_toric_variety)
0.084 cone (sage.geometry.all)
0.084 zope.interface (twisted.persisted.styles)
0.081 sage_timeit_class (sage.misc.all)
0.081 sage.rings.complex_double (sage.misc.functional)
-0.081 sage_timeit (sage_timeit_class)
0.080 add_newdocs (numpy)
-0.079 interpreter (sage_timeit)
-0.078 IPython.ipapi (interpreter)
0.076 pkg_resources (zope.interface)
0.073 lib (add_newdocs)
0.073 sage.combinat.all (sage.all)
0.063 type_check (lib)
0.063 numpy.core.numeric (type_check)
0.063 sage.algebras.all (sage.all)
0.046 numeric (numpy.core.numeric)
0.046 misc (sage.misc.all)
0.045 sage.combinat.posets.posets (cone)
0.042 sage.graphs.all (sage.combinat.posets.posets)
0.041 Shell (IPython.ipapi)
0.039 sage.server.all (sage.all)
0.037 notebook.all (sage.server.all)
0.037 sagenb.notebook.all (notebook.all)
0.037 notebook_object (sagenb.notebook.all)

@robertwb
Copy link
Contributor

robertwb commented Dec 2, 2010

comment:10

I'm in favor of any patches that remove unnecessary imports, as it will make the import order (which is now a mess) easier to understand and actual speedups easier to achieve.

@jdemeyer
Copy link

jdemeyer commented Dec 2, 2010

Merged: sage-4.6.1.alpha3

@jdemeyer
Copy link

jdemeyer commented Dec 2, 2010

Changed keywords from none to import startuptime

@jdemeyer
Copy link

jdemeyer commented Dec 2, 2010

comment:11

Replying to @robertwb:

I'm in favor of any patches that remove unnecessary imports, as it will make the import order (which is now a mess) easier to understand and actual speedups easier to achieve.

As you wish :-)

@jdemeyer jdemeyer added this to the sage-4.6.1 milestone Dec 2, 2010
@jdemeyer jdemeyer closed this as completed Dec 2, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants