Only allocate memory in CropType if use_crop is true
Maybe there's a reason it's allocated even if use_crop is false, but it seems like this might be a big performance (memory) win for non-crop setups such as used in PPE work.
Related to #229.
I'm pretty sure this comes from a phase we went through where we figured allocating everything even when not needed would speed up development. Because it does take time to get the logic right. And since crop on was considered the default, the thinking was we should let it take up more memory. The other thing here was that memory scales with processor count, so you just add in more processors if needed. What we didn't think of was the performance impact.
However, this shows how that wasn't a good practice and not something we should continue doing. So this would be an easy thing to bring in that should help.
Rethinking this. The performance impact of allocating arrays that are allocated, but never used is going to be minimal. Still good to lower total memory though.
What does have an impact on performance is arrays that are used and dimensioned to include PFTs that won't be used, so for example including all 64 crop types when only the 2 generic might be needed. That has a big impact when it gets loaded to cache as it'll have a ton of data that isn't used. So it will be loading to cache almost constantly rather than loading data that it goes through most of.
What does have an impact on performance is arrays that are used and dimensioned to include PFTs that won't be used
Yeah, that's #229, right?
Yep #229 is the main thing. And #829 is a bigger refactoring that would also possibly be even better.
Those are the two existing issues that I saw that made the most sense in terms of helping with cache memory.