Ticket #3568 (new enhancement)

Opened 5 months ago

Last modified 4 months ago

[with patch, needs work] optimize sage startup -- don't import twisted.web2 until needed

Reported by: was Assigned to: boothby
Priority: major Milestone: sage-3.2.2
Component: notebook Keywords:
Cc:

Description

BEFORE

teragon-2:databases was$ sage -startuptime |grep -i web2
           twisted.web2: 0.106 (twist)
            twisted.python: 0.004 (twisted.web2)
            twisted._version: 0.001 (twisted.web2)
            twisted.web2._version: 0.000 (twisted.web2)
            cgi: 0.004 (twisted.web2)
            twisted.internet: 0.011 (twisted.web2)
            twisted.persisted: 0.001 (twisted.web2)
            zope.interface.adapter: 0.001 (twisted.web2)
            calendar: 0.002 (twisted.web2)
            twisted.internet.defer: 0.000 (twisted.web2)
            twisted.internet.interfaces: 0.000 (twisted.web2)
             twisted.web2.stream: 0.000 (OpenSSL)
             twisted.web2.filter.range: 0.001 (OpenSSL)
             twisted.web2.responsecode: 0.000 (OpenSSL)
             twisted.web2.channel.cgi: 0.001 (OpenSSL)
             twisted.web2.channel.scgi: 0.000 (OpenSSL)
              twisted.web2.channel: 0.000 (twisted.web2.channel.scgi)
             twisted.web2.channel.http: 0.002 (OpenSSL)
             twisted.web2.channel.fastcgi: 0.000 (OpenSSL)
0.106 twisted.web2 (twist)

This is on os x with disk caching.

Attachments

sage-3568.patch (1.8 kB) - added by was on 07/06/2008 01:08:58 PM.
sage-3568-part2.patch (6.8 kB) - added by was on 07/06/2008 04:24:03 PM.
3568-was-notebook-startup-and-test-object.patch (11.2 kB) - added by ncalexan on 08/10/2008 02:32:49 PM.

Change History

07/06/2008 01:08:09 PM changed by was

AFTER (also, apply #3560):

teragon-2:notebook was$ sage -startuptime |grep web2
teragon-2:notebook was$ 

And if you apply #3560 maybe something like this:

teragon-2:notebook was$ sage -startuptime |grep notebook
      notebook.all: 0.005 (sage.server.all)
       notebook_object: 0.003 (notebook.all)
        run_notebook: 0.002 (notebook_object)
         getpass: 0.001 (run_notebook)
       sagetex: 0.000 (notebook.all)
       interact: 0.002 (notebook.all)

07/06/2008 01:08:58 PM changed by was

  • attachment sage-3568.patch added.

07/06/2008 01:09:09 PM changed by was

  • summary changed from optimize sage startup -- don't import twisted.web2 until needed to [with patch; needs review] optimize sage startup -- don't import twisted.web2 until needed.

07/06/2008 01:13:40 PM changed by mhansen

  • summary changed from [with patch; needs review] optimize sage startup -- don't import twisted.web2 until needed to [with patch; positive review] optimize sage startup -- don't import twisted.web2 until needed.

+1

07/06/2008 02:23:35 PM changed by was

  • summary changed from [with patch; positive review] optimize sage startup -- don't import twisted.web2 until needed to [with patch; not ready for review] optimize sage startup -- don't import twisted.web2 until needed.

This got a positive review (see above).

Actually this breaks all the new doctests in worksheet.py that assume that that server.notebook has been imported. The fix will be to write a function that imports sage.server.notebook and makes a sample notebook; this will be even cleaner actually. I'll attach this soon.

07/06/2008 04:24:03 PM changed by was

  • attachment sage-3568-part2.patch added.

07/06/2008 04:24:28 PM changed by was

  • summary changed from [with patch; not ready for review] optimize sage startup -- don't import twisted.web2 until needed to [with patch; needs review (again)] optimize sage startup -- don't import twisted.web2 until needed.

08/10/2008 02:32:49 PM changed by ncalexan

  • attachment 3568-was-notebook-startup-and-test-object.patch added.

08/10/2008 02:35:00 PM changed by ncalexan

  • summary changed from [with patch; needs review (again)] optimize sage startup -- don't import twisted.web2 until needed to [with patch, with positive review] optimize sage startup -- don't import twisted.web2 until needed.

I had some doctest problems with 3.0.6, due to not importing a module, that are now fixed.

Apply only 3568-was-notebook-startup-and-test-object.patch}.

All credit to was.

08/10/2008 09:17:49 PM changed by mabshoff

  • summary changed from [with patch, with positive review] optimize sage startup -- don't import twisted.web2 until needed to [with patch, needs work] optimize sage startup -- don't import twisted.web2 until needed.

For some reason this patch causes massive doctest failures:

        sage -t -long devel/sage/sage/server/notebook/cell.py # 1 doctests failed
        sage -t -long devel/sage/sage/rings/real_double.pyx # 0 doctests failed
        sage -t -long devel/sage/sage/misc/session.pyx # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/weight_space.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/type_reducible.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/type_dual.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/type_G.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/type_F.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/type_E.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/type_A.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/root_space.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/ambient_space.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/dynkin_diagram.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/root_system.py # 3 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/cartan_type.py # 2 doctests failed
        sage -t -long devel/sage/sage/combinat/crystals/tensor_product.py # 4 doctests failed
        sage -t -long devel/sage/sage/combinat/crystals/spins.py # 2 doctests failed
        sage -t -long devel/sage/sage/combinat/crystals/letters.py # 1 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/weyl_group.py # 2 doctests failed
        sage -t -long devel/sage/sage/combinat/root_system/weyl_characters.py # 4 doctests failed

Cheers,

Michael