mirror of
https://github.com/pocoproject/poco.git
synced 2025-12-12 21:14:57 +01:00
* chore(CppParser): 0, NULL --> nullptr * chore(Crypto): 0, NULL --> nullptr * chore(DNSSD): 0, NULL --> nullptr * chore(Encodings): 0, NULL --> nullptr * chore(CppUnit): Correct indentation. * chore(Foundation): 0, NULL --> nullptr * chore(CMake): Always warn about wrong nullptr usage when compiling with GCC or CLang * chore(Net): 0, NULL --> nullptr * chore(Foundation): 0, NULL --> nullptr * chore(Data): 0, NULL --> nullptr * chore(macOS): 0, NULL --> nullptr * chore(XML): 0, NULL --> nullptr * chore(Zip): 0, NULL --> nullptr * chore(Util): 0, NULL --> nullptr * chore(Net/NetSSL): 0, NULL --> nullptr * chore(Bonjour): 0, NULL --> nullptr * chore(MongoDB, Redis): 0, NULL --> nullptr * chore(Poco): 0, NULL --> nullptr * chore(Win32): 0, NULL --> nullptr * chore(CMake): Only warn about nullptr when verbose warnings are enabled. * Potential fix for code scanning alert no. 1634: Guarded Free Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore(Net): Fix warning reported by gitlab. * chore(gitlab CI): attempt to clean to gain disk space on the runner. * chore(gitlab CI): Run build with --parallel 4, correct docker cleanup. --------- Co-authored-by: Aleksandar Fabijanic <aleks-f@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#include "benchmark_utils.h"
|
|
|
|
#include <fstream>
|
|
#include <iostream>
|
|
|
|
#include "SQLParser.h"
|
|
|
|
size_t getNumTokens(const std::string& query) {
|
|
std::vector<int16_t> tokens;
|
|
hsql::SQLParser::tokenize(query, &tokens);
|
|
return tokens.size();
|
|
}
|
|
|
|
void BM_TokenizeBenchmark(benchmark::State& st, const std::string& query) {
|
|
st.counters["num_tokens"] = getNumTokens(query);
|
|
st.counters["num_chars"] = query.size();
|
|
|
|
while (st.KeepRunning()) {
|
|
std::vector<int16_t> tokens(512);
|
|
hsql::SQLParser::tokenize(query, &tokens);
|
|
}
|
|
}
|
|
|
|
void BM_ParseBenchmark(benchmark::State& st, const std::string& query) {
|
|
st.counters["num_tokens"] = getNumTokens(query);
|
|
st.counters["num_chars"] = query.size();
|
|
|
|
while (st.KeepRunning()) {
|
|
hsql::SQLParserResult result;
|
|
hsql::SQLParser::parse(query, &result);
|
|
if (!result.isValid()) {
|
|
std::cout << query << std::endl;
|
|
std::cout << result.errorMsg() << std::endl;
|
|
st.SkipWithError("Parsing failed!");
|
|
}
|
|
}
|
|
}
|
|
|
|
std::string readFileContents(const std::string& file_path) {
|
|
std::ifstream t(file_path.c_str());
|
|
std::string text((std::istreambuf_iterator<char>(t)),
|
|
std::istreambuf_iterator<char>());
|
|
return text;
|
|
}
|