Opened 8 years ago

Last modified 5 years ago

#11043 needs_work defect

Lazily import plot.

Reported by: robertwb Owned by: jason
Priority: major Milestone: sage-6.4
Component: misc Keywords: sd32
Cc: kcrisman Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by was)

Improve startup time.

Attachments (3)

11043-lazy-plot.patch (7.1 KB) - added by robertwb 8 years ago.
11043-lazy-plot-rebase4.7.1.patch (6.5 KB) - added by was 8 years ago.
11043-lazy-plot-again.patch (16.3 KB) - added by robertwb 8 years ago.
apply only this patch

Download all attachments as: .zip

Change History (15)

Changed 8 years ago by robertwb

comment:1 Changed 8 years ago by robertwb

  • Description modified (diff)
  • Status changed from new to needs_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 8 years ago by was

comment:2 Changed 8 years ago by was

  • Status changed from needs_review to needs_work

comment:3 Changed 8 years ago by robertwb

  • Status changed from needs_work to needs_review

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

Changed 8 years ago by robertwb

apply only this patch

comment:4 Changed 8 years ago by was

  • Description modified (diff)
  • Summary changed from Lazily import plot, numpy, etc. to Lazily import plot.

comment:5 Changed 8 years ago by was

  • Status changed from needs_review to needs_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 8 years ago by was

  • Keywords sd32 added

comment:7 Changed 7 years ago by drkirkby

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 7 years ago by kcrisman

  • Cc kcrisman added

comment:9 Changed 6 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:10 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:11 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:12 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.