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

Lazily import plot. #11043

Closed
robertwb opened this issue Mar 26, 2011 · 11 comments
Closed

Lazily import plot. #11043

robertwb opened this issue Mar 26, 2011 · 11 comments
Assignees

Comments

@robertwb
Copy link
Contributor

Improve startup time.

CC: @kcrisman

Component: misc

Keywords: sd32

Reviewer: Dima Pasechnik

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

@robertwb

This comment has been minimized.

@robertwb
Copy link
Contributor Author

comment:1

Attachment: 11043-lazy-plot.patch.gz

Before

2.039 sage.all (None)
0.410 sage.misc.all (sage.all)
0.260 twisted.persisted.styles (sage.all)
0.221 sage.rings.all (sage.all)
0.188 sage.functions.all (sage.all)
0.171 functional (sage.misc.all)
0.164 piecewise (sage.functions.all)
0.162 sage.calculus.all (piecewise)
0.155 desolvers (sage.calculus.all)
0.154 sage.plot.all (desolvers)
0.151 zope.interface (twisted.persisted.styles)
0.137 pkg_resources (zope.interface)
0.132 interpreter (sage.misc.all)
0.131 IPython.ipapi (interpreter)

After

1.745 sage.all (None)
0.405 sage.misc.all (sage.all)
0.263 twisted.persisted.styles (sage.all)
0.180 sage.rings.all (sage.all)
0.168 functional (sage.misc.all)
0.154 zope.interface (twisted.persisted.styles)
0.141 pkg_resources (zope.interface)
0.134 sage.combinat.all (sage.all)
0.128 interpreter (sage.misc.all)
0.127 IPython.ipapi (interpreter)

That's another quarter-second (12.5%) savings.

@williamstein
Copy link
Contributor

comment:2

Attachment: 11043-lazy-plot-rebase4.7.1.patch.gz

@robertwb
Copy link
Contributor Author

comment:3

This is a more conservative patch which only saves importing the plot.* modules (about a 50-100ms savings on my computer).

@robertwb
Copy link
Contributor Author

Attachment: 11043-lazy-plot-again.patch.gz

apply only this patch

@williamstein

This comment has been minimized.

@williamstein williamstein changed the title Lazily import plot, numpy, etc. Lazily import plot. Aug 24, 2011
@williamstein
Copy link
Contributor

comment:5

Robert, did you even test this? It seems to fail doctests all over the place. E.g.,

sage -t  devel/sage/sage/calculus/riemann.pyx
**********************************************************************
File "/mnt/usb1/scratch/wstein/sage-4.7.1-sage.math.washington.edu-x86_64-Linux/devel/sage-main/sage/calculus/riemann.pyx", line 114:
    sage: m = Riemann_Map([f, hf], [hf, hfprime], 0.5 + 0.5*I)
Exception raised:
    Traceback (most recent call last):
      File "/mnt/usb1/scratch/wstein/sage-4.7.1-sage.math.washington.edu-x86_64-Linux/local/bin/ncadoctest.p
...
ImportError: No module named riemann

It seems like using LazyImport in any nontrivial way always results in serious breakage that is revealed by doctests. I hit this numerous times myself. Hmmm.

@williamstein
Copy link
Contributor

Changed keywords from none to sd32

@sagetrac-drkirkby
Copy link
Mannequin

sagetrac-drkirkby mannequin commented Mar 2, 2012

comment:7

Is anything happening on this? Robert wrote the patch, William says it breaks doctests all over the place, but then it just stalls.

Dave

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@dimpase
Copy link
Member

dimpase commented Jul 9, 2020

comment:13

outdated

@dimpase
Copy link
Member

dimpase commented Jul 9, 2020

Reviewer: Dima Pasechnik

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

6 participants