I've been struggling to finish this pair trading strategy backtest. I've run this strategy in frameworks four times, but every time would cost me at least 24 hours and still not yet complete. I'm wondering is there a system or way that I can see whether it's slow because I use too many memories or other clues that I can help improve my algorithm?

Would love to have some senior professionalists' help! Thank you so much!