cv::drawContours performs slower and slower

MRE required. you provided nothing that can be debugged.