#11342: Make getattr faster on parents and elements
---------------------------+------------------------------------------------
   Reporter:  SimonKing    |          Owner:                        
       Type:  enhancement  |         Status:  needs_review          
   Priority:  major        |      Milestone:  sage-4.7.1            
  Component:  performance  |       Keywords:  getattr parent element
Work_issues:               |       Upstream:  N/A                   
   Reviewer:               |         Author:  Simon King            
     Merged:               |   Dependencies:  #9944                 
---------------------------+------------------------------------------------

Comment(by SimonKing):

 Replying to [comment:6 hivert]:
 > As I already said: [It] is pure Python so that probably a little
 Cythonizing is needed if it fits you needs.
 >
 > Plus compared to your code I have have to pay the extra cost of calling
 the operator {{{__mod__}}} for {{{%}}} when binding the string to its
 extra args. If you want speed from cython, it would be better to have this
 extra binding in a non standard def method so that you can bypass the call
 to python interpreter. Do you accept a little slow down (calling %) as a
 trade-off to avoid code and feature duplication ?

 I don't think that there is any code or feature duplication.

 Certainly there is no code duplication.

 What you can do with `AttributeErrorMessage` can not directly be done with
 a format string (lazy or not), because you need to distinguish two cases.
 And what you can do with lazy format strings can not be done with an
 `AttributeErrorMessage`, since the only thing that the new class can do is
 to print itself as an error message. So, there is no feature duplication
 either.

 Moreover, this ticket explicitly is about speed. A slow down by an extra
 call to __mod__ would thus not be acceptable, IMO. In particular if that
 call makes the attribute access slower than with unpatched sage.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11342#comment:8>
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