You should probably identify and quantify the bottlenecks first. My guess is this in an XY problem and you’re IO bound or your architecture is doing something bad like a linear complexity algo calling a linear complexity algo in your iteration, and a 1:1 translation to C++ probably won’t have much benefit.