The first thing you want to do is profile your code to see where it takes time. You can do it with the @profview
macro in the VSCode Julia REPL, or with packages like ProfileView.jl. There are more details on performance engineering at https://modernjuliaworkflows.org