> which is too much time to complete.
How much time is "too much"? Hours, days, months?
> Here the size of obj_pixel is in range of 0 to 30,000 which represents the pixels belonging to a same object
Sure, and 300003
for your three nested loops is 2.7×10¹³
Even if you manage 109
iterations per second (just a few instructions on your average desktop), that's 27000 seconds (~8 hours).
You could make sure all your auto loops like auto &&p0 : obj_pixel
, and all your "function of" use (const) references as well.
But TBH, you need a better algorithm, not tweaks to a brute-force try everything.
Maybe if you explained the problem, not how to make your solution work, we could offer suggestions.
> obj[function of p0,p1,p2,pv] = function of p0,p1,p2;
So not just a few instructions then.
Probably more like a few 1000.
> oa << obj;
How big is this file when you've created it?