mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
* synthon perf: replace O(N) haveEnoughHits scan with O(1) atomic counter processPartHitsFromDetails called haveEnoughHits after each verified hit, which scanned every slot of the pre-sized results vector (up to toTryChunkSize = 2.5M entries) to count non-null entries via std::accumulate. With ~3000 verified hits per search that is ~7.5B pointer reads per query. Replace with a std::atomic<int64_t> numHitsFound counter in makeHitsFromToTry, incremented via fetch_add on each verified hit. The early-exit condition becomes a single atomic read, O(1) per hit regardless of vector size. The atomic is local to makeHitsFromToTry so it resets correctly per chunk and is safe for the multi-threaded path without added synchronization. Measured on synthon_perf branch (42-rxn / 140B-product Freedom space, maxHits=3000, hitStart=1000, before boost::unordered_flat_set change): search-several (9 queries): ~30s → ~16.5s (~1.8x) search-one (benzene): ~3.5s → ~1.8s (~1.9x) All 4 synthon ctest cases pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * style ++ * Update Code/GraphMol/SynthonSpaceSearch/SynthonSpaceSearcher.cpp Co-authored-by: Greg Landrum <greg.landrum@gmail.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Greg Landrum <greg.landrum@gmail.com>