Help in making the code faster and/or reducing allocations?

Thank you for the replies! I have realized this won’t be productive due to the length of the code so I’m closing this. I believe I can’t delete the thread myself but have flagged it so that it can be deleted sometime in the future.

Could one make a more minimial MWE? This is rather long.

One suggestion would be to run the profiler, find the few lines where all the time is spent and then just show those lines. Would that be helpful to those who try to reply?

For example, it’s hard to say whether you actually need parameters to be mutable due to the length of the example.

One detail: did you mean the type declarations to be, for example, F :: Float64? I’m asking because Float64 is a concrete type (no subtypes).

1 Like

Your code is very hard to read. Could you at least point out what the hot spots are?

One thing that’s confusing is that you appear to use broadcasting everywhere, even when operating on scalars. That makes the code even harder to comprehend.

Maybe some more comments would help too.

1 Like