Changes between Version 1 and Version 2 of Ticket #30291, comment 18


Ignore:
Timestamp:
08/08/20 08:51:47 (4 months ago)
Author:
gh-mjungmath
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30291, comment 18

    v1 v2  
    1 **Setup:**
    2 
    3 {{{
    4 sage: M = Manifold(2, 'M', structure='topological') # the 2-dimensional sphere S^2
    5 sage: U = M.open_subset('U') # complement of the North pole
    6 sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
    7 sage: V = M.open_subset('V') # complement of the South pole
    8 sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
    9 sage: M.declare_union(U,V)   # S^2 is the union of U and V
    10 sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
    11 ....:                                intersection_name='W',
    12 ....:                                restrictions1= x^2+y^2!=0,
    13 ....:                                restrictions2= u^2+v^2!=0)
    14 sage: uv_to_xy = xy_to_uv.inverse()
    15 sage: f = M.scalar_field({c_xy: 1/(1+x^2+y^2), c_uv: (u^2+v^2)/(1+u^2+v^2)},
    16 ....:                    name='f')
    17 }}}
    18 
    19 
    20 **Current state:**
    21 
    22 {{{
    23 sage: %timeit f*1
    24 The slowest run took 29.55 times longer than the fastest. This could mean that an intermediate result is being cached.
    25 100000 loops, best of 5: 11.8 µs per loop
    26 sage: %timeit 1*f
    27 The slowest run took 53.68 times longer than the fastest. This could mean that an intermediate result is being cached.
    28 100000 loops, best of 5: 11.3 µs per loop
    29 sage: %timeit f*f
    30 10 loops, best of 5: 77.8 ms per loop
    31 }}}
    32 
    33 **With this ticket:**
    34 
    35 {{{
    36 sage: %timeit f*1
    37 The slowest run took 28.26 times longer than the fastest. This could mean that an intermediate result is being cached.
    38 100000 loops, best of 5: 12.3 µs per loop
    39 sage: %timeit 1*f
    40 The slowest run took 71.02 times longer than the fastest. This could mean that an intermediate result is being cached.
    41 100000 loops, best of 5: 12.4 µs per loop
    42 sage: %timeit f*f
    43 10 loops, best of 5: 77.4 ms per loop
    44 }}}
    45 
    46 **Conclusion:**
    47 
    48 Interestingly, `f*f` is faster and `1*f` is slower...I am curious about the impact on the larger scale, i.e. more charts and more complicated expressions.
    49