Opened 8 years ago
Closed 8 years ago
#10220 closed enhancement (fixed)
Unnecessary imports cause slower sage startup
Reported by: | jason | Owned by: | tbd |
---|---|---|---|
Priority: | major | Milestone: | sage-4.6.1 |
Component: | performance | Keywords: | import startuptime |
Cc: | robertwb, mhansen | Merged in: | sage-4.6.1.alpha3 |
Authors: | Jason Grout | Reviewers: | Jeroen Demeyer |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
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.
Attachments (1)
Change History (12)
Changed 8 years ago by
comment:1 Changed 8 years ago by
- Cc robertwb mhansen added
- Status changed from new to needs_work
comment:2 Changed 8 years ago by
What is the actual speedup?
comment:3 Changed 8 years ago by
- Reviewers set to Jeroen Demeyer
- Status changed from needs_work to positive_review
Works for me.
comment:4 follow-up: ↓ 5 Changed 8 years ago by
What is the actual speedup?
comment:5 in reply to: ↑ 4 Changed 8 years ago by
- Milestone set to sage-4.6.1
comment:6 follow-up: ↓ 7 Changed 8 years ago by
To really speed stuff up you have to eliminate all imports of a module. Easier said than done.
comment:7 in reply to: ↑ 6 Changed 8 years ago by
Replying to robertwb:
To really speed stuff up you have to eliminate all imports of a module. Easier said than done.
For example, http://trac.sagemath.org/sage_trac/ticket/6494
comment:8 Changed 8 years ago by
- Milestone changed from sage-4.6.1 to sage-feature
Should this be merged if it doesn't change the startuptime?
comment:9 Changed 8 years ago by
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)
comment:10 follow-up: ↓ 11 Changed 8 years ago by
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.
comment:11 in reply to: ↑ 10 Changed 8 years ago by
- Keywords import startuptime added
- Merged in set to sage-4.6.1.alpha3
- Milestone changed from sage-feature to sage-4.6.1
- Resolution set to fixed
- Status changed from positive_review to closed
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 :-)
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.