Skip to content

Instantly share code, notes, and snippets.

@cswiercz
Created January 7, 2016 22:27
Show Gist options
  • Save cswiercz/97d9c5c9ffd5d0a8a662 to your computer and use it in GitHub Desktop.
Save cswiercz/97d9c5c9ffd5d0a8a662 to your computer and use it in GitHub Desktop.
Pure Sage Riemann Matrix Timings
Thu Jan 7 14:06:54 2016 test.profile
7206599 function calls (7193937 primitive calls) in 67.121 seconds
Ordered by: internal time
List reduced from 1682 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
107328 29.405 0.000 31.848 0.000 analytic_continuation_smale.py:44(newton)
321984 19.540 0.000 21.290 0.000 analytic_continuation_smale.py:79(smale_beta)
107328 7.152 0.000 7.854 0.000 analytic_continuation_smale.py:103(smale_gamma)
583634/583326 4.116 0.000 4.946 0.000 complex_field.py:353(_element_constructor_)
34816 1.049 0.000 1.151 0.000 differentials.py:287(eval)
36224 0.964 0.000 62.267 0.002 analytic_continuation_smale.py:196(analytically_continue)
2651628 0.651 0.000 0.651 0.000 {isinstance}
72375/72371 0.230 0.000 0.230 0.000 {numpy.core.multiarray.array}
34816 0.207 0.000 61.988 0.002 function_base.py:1869(_vectorize_call)
360884 0.179 0.000 0.179 0.000 {range}
34816 0.156 0.000 61.510 0.002 analytic_continuation_smale.py:280(omega_gamma)
107328 0.141 0.000 15.335 0.000 analytic_continuation_smale.py:135(smale_alpha)
583634 0.131 0.000 0.131 0.000 complex_field.py:43(late_import)
583326 0.120 0.000 0.120 0.000 complex_field.py:283(_real_field)
26848 0.118 0.000 0.118 0.000 riemann_surface_path.py:619(get_x)
2864 0.096 0.000 62.156 0.022 quadrature.py:111(vfunc)
34904 0.096 0.000 0.123 0.000 riemann_surface_path.py:251(_nearest_checkpoint_index)
8952/8918 0.086 0.000 0.098 0.000 complex_interval_field.py:364(__call__)
6326/6085 0.082 0.000 0.211 0.000 multi_polynomial_ring.py:184(__call__)
34904 0.080 0.000 60.166 0.002 riemann_surface_path.py:371(get_y)
@cswiercz
Copy link
Author

cswiercz commented Jan 7, 2016

This is from a pure Sage (no Cython) version of Abelfunctions. The numerics is really really slow compared to the older Cython version. For example, on my machine the above runs in 67s whereas before a Riemann matrix could be calculated in 4s.

Eventual Cythonization is preferred but at the time of this writing compiling Abelfunction Cython code from Sage doesn't really work.

@cswiercz
Copy link
Author

cswiercz commented Jan 7, 2016

Now here's something interesting: I use Numpy data types everywhere because reasons. Well, changing all instances of

fast_callable(foo, vars=[x,y])

to

fast_callable(foo, vars=[x,y], domain=numpy.complex)

resulted in the following awesome speedup:

Thu Jan  7 14:54:03 2016    test.profile

         3126477 function calls (3113809 primitive calls) in 12.873 seconds

   Ordered by: internal time
   List reduced from 1682 to 20 due to restriction <20>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   107328    3.676    0.000    3.676    0.000 analytic_continuation_smale.py:46(newton)
   107328    2.612    0.000    2.664    0.000 analytic_continuation_smale.py:107(smale_gamma)
   321984    2.005    0.000    2.005    0.000 analytic_continuation_smale.py:83(smale_beta)
    36224    0.718    0.000    9.308    0.000 analytic_continuation_smale.py:200(analytically_continue)
72375/72371    0.192    0.000    0.192    0.000 {numpy.core.multiarray.array}
    34816    0.169    0.000   10.072    0.000 function_base.py:1869(_vectorize_call)
    34816    0.151    0.000    0.151    0.000 differentials.py:289(eval)
   360884    0.140    0.000    0.140    0.000 {range}
    34816    0.127    0.000    9.675    0.000 analytic_continuation_smale.py:284(omega_gamma)
    26848    0.113    0.000    0.113    0.000 riemann_surface_path.py:619(get_x)
   107328    0.109    0.000    3.496    0.000 analytic_continuation_smale.py:139(smale_alpha)
    34904    0.092    0.000    0.114    0.000 riemann_surface_path.py:251(_nearest_checkpoint_index)
   319766    0.087    0.000    0.087    0.000 {isinstance}
8952/8918    0.081    0.000    0.092    0.000 complex_interval_field.py:364(__call__)
6326/6085    0.078    0.000    0.209    0.000 multi_polynomial_ring.py:184(__call__)
     2864    0.075    0.000   10.208    0.004 quadrature.py:111(vfunc)
    34904    0.074    0.000    9.240    0.000 riemann_surface_path.py:371(get_y)
     9300    0.068    0.000    0.193    0.000 polynomial_ring.py:318(_element_constructor_)
    12608    0.064    0.000    0.064    0.000 riemann_surface_path.py:623(get_dxdt)
    26473    0.064    0.000    0.412    0.000 qqbar.py:3151(__init__)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment