Removed sorting of similar candidate_gates for unnessessary optimization

This commit is contained in:
AdvaySingh1 2026-02-18 09:08:25 -08:00
parent 6cb9fadded
commit ee896b9eee
1 changed files with 3 additions and 8 deletions

View File

@ -450,17 +450,12 @@ struct InferCeWorker
for (auto idx : net_to_accepted[bit])
candidate_gates.insert(idx);
// HEURISTIC: Only check top 3 gates (by size) for reuse
const int MAX_REUSE_CHECKS = 3;
std::vector<size_t> sorted_candidates(candidate_gates.begin(), candidate_gates.end());
std::sort(sorted_candidates.begin(), sorted_candidates.end(), [&](size_t a, size_t b) {
return accepted_gates[a].regs.size() > accepted_gates[b].regs.size();
});
// HEURISTIC: Only check limited gates for reuse
const int MAX_REUSE_CHECKS = 20;
bool found_match = false;
int checked = 0;
for (auto idx : sorted_candidates) {
for (auto idx : candidate_gates) {
if (checked >= MAX_REUSE_CHECKS)
break;