Thank you very much for the hints, I appreciate it.
What would you suggest to profile such a code? Right now I am just using the “time” package to measure the runtime, but this is inefficient if one wanted to measure all the components individually.