Opened 12 years ago

Closed 18 months ago

#11043 closed defect (invalid)

Lazily import plot.

Reported by: Robert Bradshaw Owned by: Jason Grout
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: misc Keywords: sd32
Cc: Karl-Dieter Crisman Merged in:
Authors: Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by William Stein)

Improve startup time.

Attachments (3)

11043-lazy-plot.patch (7.1 KB) - added by Robert Bradshaw 12 years ago.
11043-lazy-plot-rebase4.7.1.patch (6.5 KB) - added by William Stein 11 years ago.
11043-lazy-plot-again.patch (16.3 KB) - added by Robert Bradshaw 11 years ago.
apply only this patch

Download all attachments as: .zip

Change History (17)

Changed 12 years ago by Robert Bradshaw

Attachment: 11043-lazy-plot.patch added

comment:1 Changed 12 years ago by Robert Bradshaw

Description: modified (diff)
Status: newneeds_review

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.

Changed 11 years ago by William Stein

comment:2 Changed 11 years ago by William Stein

Status: needs_reviewneeds_work

comment:3 Changed 11 years ago by Robert Bradshaw

Status: needs_workneeds_review

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

Changed 11 years ago by Robert Bradshaw

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

apply only this patch

comment:4 Changed 11 years ago by William Stein

Description: modified (diff)
Summary: Lazily import plot, numpy, etc.Lazily import plot.

comment:5 Changed 11 years ago by William Stein

Status: needs_reviewneeds_work

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.

comment:6 Changed 11 years ago by William Stein

Keywords: sd32 added

comment:7 Changed 11 years ago by David Kirkby

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

Dave

comment:8 Changed 11 years ago by Karl-Dieter Crisman

Cc: Karl-Dieter Crisman added

comment:9 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11sage-5.12

comment:10 Changed 9 years ago by For batch modifications

Milestone: sage-6.1sage-6.2

comment:11 Changed 9 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:12 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4

comment:13 Changed 2 years ago by Dima Pasechnik

Milestone: sage-6.4sage-duplicate/invalid/wontfix
Reviewers: Dima Pasechnik
Status: needs_workpositive_review

outdated

comment:14 Changed 18 months ago by Matthias Köppe

Resolution: invalid
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.