Newton + LineSearch in Hot Loop: Reduce allocations

If you use NonlinearSolve.jl there are a couple of options:

  1. Use SimpleNonlinearSolve Code Optimization for Small Nonlinear Systems in Julia · NonlinearSolve.jl that will pretty much outperform most solvers for scalar/static arrays problems
  2. Use the caching interface of cache = init(....) and inside the loop first do reinit!(cache; p = <bla, bla, bla>) and then solve!(cache)
3 Likes