CreateIniStates: Huge computation time spent on GetFeatModel
The Rstudio profiler on airGRiwrm calibration with ungauged nodes returns this result:
We see that on 3.46 sec of calculation, 1.62 sec are spent in CreateIniStates and especially in the call to .GetFeatModel which take a lot of time to run system.file and read.table.
One first quick solution would be to add in Calibration, a copy of model features from RunOptions to InputsModel in order to provide them to CreateIniStates through InputsModel.
If we think of more structured solution, model features could be attached from the beginning to the InputsModel object and propagated to all subsequent objects used in simulation/calibration without the need to call again the expensive .GetFeatModel function. This point of view change substantially the call to airGR functions because we would need to precise IsSD and IsHyst parameters in the CreateInputsModel call. This also would simplify the calls to other Create... functions which would not need these parameters anymore.
@guillaume.thirel, @olivier.delaigue, if you agree with this point of view, this proposed solution needs further investigation in order to avoid breaking changes and take into account any legacy and new call to airGR functions. Maybe in a separated ticket issue ?
