From b415bb77ff12c7a6d1e10165d0173acf309b46ff Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sun, 15 Oct 2023 14:58:54 -0400 Subject: [PATCH] perf: update whatwg_url package to latest commit --- benchmarks/CMakeLists.txt | 3 ++- benchmarks/benchmark_header.h | 2 +- benchmarks/benchmark_template.cpp | 12 ++++++------ benchmarks/wpt_bench.cpp | 22 +++++++++++----------- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 48ce05875..30183a27c 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -91,7 +91,7 @@ if(ICU_FOUND) CPMAddPackage( NAME url_whatwg GITHUB_REPOSITORY rmisev/url_whatwg - GIT_TAG cbcf3043eccb380cb4bef7486465ac3b02d2f674 + GIT_TAG 72bcabf OPTIONS "URL_BUILD_TESTS OFF" "URL_USE_LIBS OFF" ) add_library(url_whatwg_lib STATIC "${url_whatwg_SOURCE_DIR}/src/url.cpp" @@ -101,6 +101,7 @@ if(ICU_FOUND) "${url_whatwg_SOURCE_DIR}/src/url_search_params.cpp" "${url_whatwg_SOURCE_DIR}/src/url_utf.cpp" "${url_whatwg_SOURCE_DIR}/src/url.cpp") + target_include_directories(url_whatwg_lib PUBLIC "${url_whatwg_SOURCE_DIR}/include") target_link_libraries(url_whatwg_lib PRIVATE ICU::uc ICU::i18n) diff --git a/benchmarks/benchmark_header.h b/benchmarks/benchmark_header.h index 2371a478b..2cad7d78b 100644 --- a/benchmarks/benchmark_header.h +++ b/benchmarks/benchmark_header.h @@ -11,7 +11,7 @@ #include #endif #if ADA_url_whatwg_ENABLED -#include +#include #endif #include "ada.h" diff --git a/benchmarks/benchmark_template.cpp b/benchmarks/benchmark_template.cpp index 40165fc1c..922872aa3 100644 --- a/benchmarks/benchmark_template.cpp +++ b/benchmarks/benchmark_template.cpp @@ -93,8 +93,8 @@ BENCHMARK(BasicBench_AdaURL_aggregator_href); size_t count_whatwg_invalid() { size_t how_many = 0; for (std::string& url_string : url_examples) { - whatwg::url url; - if (!whatwg::success(url.parse(url_string, nullptr))) { + upa::url url; + if (!upa::success(url.parse(url_string, nullptr))) { how_many++; } } @@ -108,8 +108,8 @@ static void BasicBench_whatwg(benchmark::State& state) { volatile size_t href_size = 0; for (auto _ : state) { for (std::string& url_string : url_examples) { - whatwg::url url; - if (whatwg::success(url.parse(url_string, nullptr))) { + upa::url url; + if (upa::success(url.parse(url_string, nullptr))) { success++; if (!just_parse) { href_size += url.href().size(); @@ -123,8 +123,8 @@ static void BasicBench_whatwg(benchmark::State& state) { std::atomic_thread_fence(std::memory_order_acquire); collector.start(); for (std::string& url_string : url_examples) { - whatwg::url url; - if (whatwg::success(url.parse(url_string, nullptr))) { + upa::url url; + if (upa::success(url.parse(url_string, nullptr))) { success++; if (!just_parse) { href_size += url.href().size(); diff --git a/benchmarks/wpt_bench.cpp b/benchmarks/wpt_bench.cpp index 156222323..2b37db119 100644 --- a/benchmarks/wpt_bench.cpp +++ b/benchmarks/wpt_bench.cpp @@ -118,22 +118,22 @@ BENCHMARK(BasicBench_AdaURL_url_aggregator); #if ADA_url_whatwg_ENABLED -#include +#include static void BasicBench_whatwg(benchmark::State &state) { volatile size_t success{}; for (auto _ : state) { for (const std::pair &url_strings : url_examples) { - whatwg::url base; - whatwg::url *base_ptr = nullptr; + upa::url base; + upa::url *base_ptr = nullptr; if (!url_strings.second.empty()) { - if (whatwg::success(base.parse(url_strings.second, nullptr))) { + if (upa::success(base.parse(url_strings.second, nullptr))) { base_ptr = &base; } } - whatwg::url url; - if (whatwg::success(url.parse(url_strings.first, base_ptr))) { + upa::url url; + if (upa::success(url.parse(url_strings.first, base_ptr))) { success++; } } @@ -145,15 +145,15 @@ static void BasicBench_whatwg(benchmark::State &state) { collector.start(); for (const std::pair &url_strings : url_examples) { - whatwg::url base; - whatwg::url *base_ptr = nullptr; + upa::url base; + upa::url *base_ptr = nullptr; if (!url_strings.second.empty()) { - if (whatwg::success(base.parse(url_strings.second, nullptr))) { + if (upa::success(base.parse(url_strings.second, nullptr))) { base_ptr = &base; } } - whatwg::url url; - if (whatwg::success(url.parse(url_strings.first, base_ptr))) { + upa::url url; + if (upa::success(url.parse(url_strings.first, base_ptr))) { success++; } }