#11734: sage_wraps should only read the sources of wrapped functions when 
needed.
-------------------------+--------------------------------------------------
   Reporter:  SimonKing  |          Owner:  jason                    
       Type:  defect     |         Status:  needs_review             
   Priority:  blocker    |      Milestone:  sage-4.7.2               
  Component:  misc       |       Keywords:  sage_wraps sources gentoo
Work_issues:             |       Upstream:  N/A                      
   Reviewer:             |         Author:  Simon King               
     Merged:             |   Dependencies:                           
-------------------------+--------------------------------------------------
Changes (by SimonKing):

  * status:  new => needs_review


Comment:

 The patch should solve the problem with prematurely reading sources on
 gentoo. However, I can not test it, myself. Francois, can you verify it?

 '''__Benefits__'''

 __Startuptime__

 The startuptime did slightly improve (but perhaps that is not
 significant):

 Without patch
 {{{
 $ ./sage -startuptime
 == Tree ==
 sage.all: 1.132 (None)
 ...
 }}}
 With patch
 {{{
 $ ./sage -startuptime
 == Tree ==
 sage.all: 1.045 (None)
 }}}

 __Memory__

 The memory consumption improved as well:

 Without patch:
 {{{
 sage: get_memory_usage()
 861.2890625
 }}}
 With patch:
 {{{
 sage: get_memory_usage()
 861.234375
 }}}

 __Bugfix__

 Not reading the sources when a function is wrapped has an additional
 benefit: If one interactively defines a lambda function and wraps it, then
 the source is not available. Hence, the following example (that is a new
 doctest) used to fail:
 {{{
         sage: def square(f):
         ...     @sage_wraps(f)
         ...     def new_f(x):
         ...         return f(x)*f(x)
         ...     return new_f
         ...
         sage: f = lambda x:x^2
         sage: g = square(f)
         sage: g(3)
         81
 }}}
 Without the patch, the last line fails with a mysterious attribute error
 (the user would certainly have not easily been able to track the problem
 down).

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11734#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to