Pressio / pressio-demoapps

Suite of 1D, 2D, 3D demo apps of varying complexity with built-in support for sample mesh and exact Jacobians

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bindings: operator (...) for pybind array_t is not efficient

fnrizzi opened this issue · comments

The operator () for pybind::array_t in line 906 of this file is not efficient. I added this myself originally since natively array_t did not support it.
One reason behind the perf issue is that looking at the impl (traces back to the parent array class, see that same file), it still performs a bound check.

Problem is that inside pressio-demoapps, we are using this to access the graph entries. We should change things to use the mutable and mutable_unchecked that seem to perform well since these proxy classes do not perform bounds check. However, we need to figure out how to handle these proxies properly.

see pybind/pybind11#4723

we have fixed this in our fork