The only more efficient way I can think of is to return the values via reference parameters.
Profilers are somewhat fuzzy about determining the exact location that's costing a lot of time. They can sometimes miss the mark by one line up or down. Are you sure it's constructing and returning the tuple that's expensive?
But make_tuple itself probably isn't the issue. The type of a tuple is all determined at compile time anyway.
If you're calling that part of the code a billion times, then that alone could be the issue.
I am not sure, of course, but I heard a rumor that it can affect the thread or smth , I dont understand well ( I am also running parallel the code on the several threads). I guess my chances just try some alternatives and see.
But yes, I am calling the code many times, and possibly it will be a billion time and more.
I am generating the chain, basically, which checks its members constantly before adding the new one, if it does not intersect with previously generated.
The runtime grows exponentially which is strange for me.
100 units - 0,3 s
500 units - 29 s
1000 units - 200 s
1500 units - 740 s
3000 units - 9450 s
For every unit the position is recalculated and compared with the new unit.
That looks like an approximately cubic growth to me, not exponential. It sounds like an algorithmic problem. You're not going to solve it with micro-optimizations.