Opened 12 years ago

Closed 12 years ago

#7502 closed enhancement (fixed)

lazy import module

Reported by: robertwb Owned by: was
Priority: major Milestone: sage-4.3.2
Component: user interface Keywords:
Cc: Merged in: sage-4.3.2.alpha1
Authors: Robert Bradshaw Reviewers: Mitesh Patel
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

This is something I came up with when trying to reduce sage start up time.

2.033 sage.all (None)
0.407 sage.server.all (sage.all)
0.404 notebook.all (sage.server.all)
0.365 sage.server.notebook.notebook (notebook.all)
...

Now notebook() needs to be in the global namespace, but usually the entire notebook server does not need to be loaded. I'm sure there's other trimming we could do here as well.

It's unclear what level to put this in, but I would think sage.server.notebook.all would be a good place (e.g. we could lazily import interact.*, sage_email.*, and lazily import notebook and inotebook). That could cut down startup time by 25%.

Attachments (2)

7502-lazy-import.patch (7.1 KB) - added by robertwb 12 years ago.
7502-lazy-import.2.patch (7.8 KB) - added by mpatel 12 years ago.
Also map tab completion. Add to reference manual. Rebased vs. 4.3.2.alpha0. Replaces previous.

Download all attachments as: .zip

Change History (8)

Changed 12 years ago by robertwb

comment:1 Changed 12 years ago by mpatel

  • Report Upstream set to N/A

Somewhat related: #8102 + #8107 reduce the startup time by cutting unnecessary imports.

comment:2 Changed 12 years ago by mpatel

By the way, is this up for review?

comment:3 Changed 12 years ago by robertwb

  • Status changed from new to needs_review

Yes.

Changed 12 years ago by mpatel

Also map tab completion. Add to reference manual. Rebased vs. 4.3.2.alpha0. Replaces previous.

comment:4 Changed 12 years ago by mpatel

  • Authors set to Robert Bradshaw
  • Reviewers set to Mitesh Patel

My review is positive, but someone should review the changes in v2.

comment:5 Changed 12 years ago by robertwb

  • Status changed from needs_review to positive_review

Thanks. Yes, your additions look good as well.

comment:6 Changed 12 years ago by mvngu

  • Merged in set to sage-4.3.2.alpha1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.