fastscape-lem / fastscape

A fast, versatile and user-friendly landscape evolution model
https://fastscape.readthedocs.io
BSD 3-Clause "New" or "Revised" License
53 stars 12 forks source link

Causes of slower execution compared to fatscapelib-fortran low-level API #3

Open benbovy opened 4 years ago

benbovy commented 4 years ago

After #1, running a model using the xarray-simlab based, high-level API here might be slightly slower than running the same model using the low-level fatscapelib-fortran API.

This is mainly due to a key difference in design between the xarray-simlab components and the fastscapelib-fortran library:

Because we reuse the functions implemented in fastscapelib-fortran for the high-level API, there is a lot of duplicate computation and copies that cannot be avoided.

Eventually switching from fastscapelib-fortran to fastscapelib C++ will solve this issue, as the latter is designed more like a library and is more compliant with the second approach explained above. This might even be faster (at the cost of more memory expensive) than using the low-level fatscapelib-fortran API as it would avoid things like: