Note
Go to the end to download the full example code
Benchmark of LowLevelCallable for Segment Quadrature#
Definition of benchmarked integrands
all_funs_scalar = {
'py_fun' : test_from_scalar_fun(py_fun) ,
'py_fun_array' : test_from_scalar_fun(py_fun_array) ,
'nb_fun' : test_from_scalar_fun(nb_fun) ,
'nb_fun_pointer' : test_from_scalar_fun(nb_fun_pointer) ,
'nb_fun_inplace_pointer' : test_from_scalar_fun(nb_fun_inplace_pointer) ,
'py_fun_in_pyx' : test_from_scalar_fun(choreo.scipy_plus.cython.test.single_py_fun) ,
'cy_fun_pointer_LowLevel' : test_from_scalar_fun(scipy.LowLevelCallable.from_cython(choreo.scipy_plus.cython.test, "single_cy_fun_pointer")),
'cy_fun_memoryview_LowLevel' : test_from_scalar_fun(scipy.LowLevelCallable.from_cython(choreo.scipy_plus.cython.test, "single_cy_fun_memoryview")),
'cy_fun_oneval_LowLevel' : test_from_scalar_fun(scipy.LowLevelCallable.from_cython(choreo.scipy_plus.cython.test, "single_cy_fun_oneval")),
}
all_funs_vect = {
'py_fun' : None,
'py_fun_array' : test_from_vect_fun(mul_py_fun_array) ,
'nb_fun' : None ,
'nb_fun_pointer' : test_from_vect_fun(mul_nb_fun_pointer) ,
'nb_fun_inplace_pointer' : test_from_vect_fun(mul_nb_fun_inplace_pointer) ,
'py_fun_in_pyx' : test_from_vect_fun(choreo.scipy_plus.cython.test.mul_py_fun),
'cy_fun_pointer_LowLevel' : test_from_vect_fun(scipy.LowLevelCallable.from_cython(choreo.scipy_plus.cython.test, "mul_cy_fun_pointer")),
'cy_fun_memoryview_LowLevel' : test_from_vect_fun(scipy.LowLevelCallable.from_cython(choreo.scipy_plus.cython.test, "mul_cy_fun_memoryview")),
}
all_benchs = {
'Scalar function' : all_funs_scalar ,
f'Vector function of size {choreo.scipy_plus.cython.test.mul_size_py}' : all_funs_vect ,
}
Total running time of the script: (0 minutes 1.085 seconds)