mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-04 21:54:27 +08:00
* Add many new c++ catch2 performance benchmarks. * inline splitmix64 from boost, splitmix64 is not always available in boost. fun fact, this version is ~twice as fast * reduce intensity of memory pressure test, target 200MB usage. * new bench compound; accept suggestion from code review * bench MolToCXSmiles * Update Code/Bench/stereo.cpp * impl first part of the suggestions from code reveiw * impl second part of the suggestions from code reveiw
56 lines
1.3 KiB
C++
56 lines
1.3 KiB
C++
#include <catch2/catch_all.hpp>
|
|
#include <string>
|
|
|
|
#include "bench_common.hpp"
|
|
|
|
#include <GraphMol/ROMol.h>
|
|
#include <GraphMol/SmilesParse/SmilesParse.h>
|
|
#include <INCHI-API/inchi.h>
|
|
|
|
using namespace RDKit;
|
|
|
|
TEST_CASE("MolToInchi", "[inchi]") {
|
|
auto samples = bench_common::load_samples();
|
|
BENCHMARK("MolToInchi") {
|
|
std::vector<std::string> inchis;
|
|
for (auto &mol : samples) {
|
|
ExtraInchiReturnValues rv;
|
|
inchis.push_back(MolToInchi(mol, rv));
|
|
}
|
|
return inchis;
|
|
};
|
|
}
|
|
|
|
TEST_CASE("InchiToInchiKey", "[inchi]") {
|
|
auto samples = bench_common::load_samples();
|
|
std::vector<std::string> inchis;
|
|
for (auto &mol : samples) {
|
|
ExtraInchiReturnValues rv;
|
|
inchis.push_back(MolToInchi(mol, rv));
|
|
}
|
|
BENCHMARK("InchiToInchiKey") {
|
|
std::vector<std::string> inchikeys;
|
|
for (auto &inchi : inchis) {
|
|
inchikeys.push_back(InchiToInchiKey(inchi));
|
|
}
|
|
return inchikeys;
|
|
};
|
|
}
|
|
|
|
TEST_CASE("InchiToMol", "[inchi]") {
|
|
auto samples = bench_common::load_samples();
|
|
std::vector<std::string> inchis;
|
|
for (auto &mol : samples) {
|
|
ExtraInchiReturnValues rv;
|
|
inchis.push_back(MolToInchi(mol, rv));
|
|
}
|
|
BENCHMARK("InchiToMol") {
|
|
std::vector<std::unique_ptr<ROMol>> mols;
|
|
for (auto &inchi : inchis) {
|
|
ExtraInchiReturnValues rv_inner;
|
|
mols.emplace_back(InchiToMol(inchi, rv_inner));
|
|
}
|
|
return mols;
|
|
};
|
|
}
|