Very strange indeed.
If you want to try and reduce/eliminate most of the allocations (will speedup as 95% is just cleaning up memory), take a look at this talk - Hunting down allocations with Julia 1.8's Allocation Profiler | JuliaCon 2022. It’s for Julia 1.8 so you would have to upgrade, but there’s a source code view which tells you which lines of your code are allocating and how much. This can be very helpful when optimising your code. It seems worth it in this case if you have to run it overnight.