#10467: Improve lookup of private attributes
---------------------------+------------------------------------------------
   Reporter:  SimonKing    |       Owner:  tbd                     
       Type:  enhancement  |      Status:  needs_review            
   Priority:  major        |   Milestone:  sage-4.6.1              
  Component:  performance  |    Keywords:  private attribute lookup
     Author:  Simon King   |    Upstream:  N/A                     
   Reviewer:               |      Merged:                          
Work_issues:               |  
---------------------------+------------------------------------------------

Comment(by SimonKing):

 On [http://groups.google.com/group/sage-
 algebra/browse_thread/thread/2c6adc1f746063ac sage-algebra], Nicolas
 ThiƩry wrote:
   "Just please make a quick benchmark (and post the result on track) to
 verify that the extra check does not induce an overhead for usual lookups
 (probably not)."

 Here are two data points.

 (1)
 I compared "`sage -tp 4 sage/`" before and after applying the patch. It is
 1810.3 seconds without the patch, but 1792.5 seconds with the patch. So,
 on average, it became quicker.

 (2)
 The timings improve if a non-existing private attribute is requested. So,
 let us test a situation where an ''existing'' categorical attribute is
 requested. For example, the method `summation` method of the rational
 field is only defined in its category.

 Without the patch, I obtained
 {{{
 sage: timeit('a=QQ.summation',number=50000)
 50000 loops, best of 3: 553 ns per loop
 sage: timeit('a=QQ.summation',number=50000)
 50000 loops, best of 3: 563 ns per loop
 sage: timeit('a=QQ.summation',number=50000)
 50000 loops, best of 3: 559 ns per loop
 }}}

 With the patch, I obtain
 {{{
 sage: timeit('a=QQ.summation',number=50000)
 50000 loops, best of 3: 530 ns per loop
 sage: timeit('a=QQ.summation',number=50000)
 50000 loops, best of 3: 514 ns per loop
 sage: timeit('a=QQ.summation',number=50000)
 50000 loops, best of 3: 539 ns per loop
 }}}

 So, that's a situation where it might expect a slight deceleration with
 the patch, but in fact it is as quick as before.

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