Skip to content

Commit 11731e8

Browse files
authored
perf: update whatwg_url package to latest commit (#539)
1 parent a4fde0d commit 11731e8

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

benchmarks/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ if(ICU_FOUND)
9191
CPMAddPackage(
9292
NAME url_whatwg
9393
GITHUB_REPOSITORY rmisev/url_whatwg
94-
GIT_TAG cbcf3043eccb380cb4bef7486465ac3b02d2f674
94+
GIT_TAG 72bcabf
9595
OPTIONS "URL_BUILD_TESTS OFF" "URL_USE_LIBS OFF"
9696
)
9797
add_library(url_whatwg_lib STATIC "${url_whatwg_SOURCE_DIR}/src/url.cpp"
@@ -101,6 +101,7 @@ if(ICU_FOUND)
101101
"${url_whatwg_SOURCE_DIR}/src/url_search_params.cpp"
102102
"${url_whatwg_SOURCE_DIR}/src/url_utf.cpp"
103103
"${url_whatwg_SOURCE_DIR}/src/url.cpp")
104+
target_include_directories(url_whatwg_lib PUBLIC "${url_whatwg_SOURCE_DIR}/include")
104105
target_link_libraries(url_whatwg_lib PRIVATE ICU::uc ICU::i18n)
105106

106107

benchmarks/benchmark_header.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <http_parser.h>
1212
#endif
1313
#if ADA_url_whatwg_ENABLED
14-
#include <src/url.h>
14+
#include <upa/url.h>
1515
#endif
1616

1717
#include "ada.h"

benchmarks/benchmark_template.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ BENCHMARK(BasicBench_AdaURL_aggregator_href);
9393
size_t count_whatwg_invalid() {
9494
size_t how_many = 0;
9595
for (std::string& url_string : url_examples) {
96-
whatwg::url url;
97-
if (!whatwg::success(url.parse(url_string, nullptr))) {
96+
upa::url url;
97+
if (!upa::success(url.parse(url_string, nullptr))) {
9898
how_many++;
9999
}
100100
}
@@ -108,8 +108,8 @@ static void BasicBench_whatwg(benchmark::State& state) {
108108
volatile size_t href_size = 0;
109109
for (auto _ : state) {
110110
for (std::string& url_string : url_examples) {
111-
whatwg::url url;
112-
if (whatwg::success(url.parse(url_string, nullptr))) {
111+
upa::url url;
112+
if (upa::success(url.parse(url_string, nullptr))) {
113113
success++;
114114
if (!just_parse) {
115115
href_size += url.href().size();
@@ -123,8 +123,8 @@ static void BasicBench_whatwg(benchmark::State& state) {
123123
std::atomic_thread_fence(std::memory_order_acquire);
124124
collector.start();
125125
for (std::string& url_string : url_examples) {
126-
whatwg::url url;
127-
if (whatwg::success(url.parse(url_string, nullptr))) {
126+
upa::url url;
127+
if (upa::success(url.parse(url_string, nullptr))) {
128128
success++;
129129
if (!just_parse) {
130130
href_size += url.href().size();

benchmarks/wpt_bench.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,22 @@ BENCHMARK(BasicBench_AdaURL_url_aggregator);
118118

119119
#if ADA_url_whatwg_ENABLED
120120

121-
#include <src/url.h>
121+
#include <upa/url.h>
122122

123123
static void BasicBench_whatwg(benchmark::State &state) {
124124
volatile size_t success{};
125125
for (auto _ : state) {
126126
for (const std::pair<std::string, std::string> &url_strings :
127127
url_examples) {
128-
whatwg::url base;
129-
whatwg::url *base_ptr = nullptr;
128+
upa::url base;
129+
upa::url *base_ptr = nullptr;
130130
if (!url_strings.second.empty()) {
131-
if (whatwg::success(base.parse(url_strings.second, nullptr))) {
131+
if (upa::success(base.parse(url_strings.second, nullptr))) {
132132
base_ptr = &base;
133133
}
134134
}
135-
whatwg::url url;
136-
if (whatwg::success(url.parse(url_strings.first, base_ptr))) {
135+
upa::url url;
136+
if (upa::success(url.parse(url_strings.first, base_ptr))) {
137137
success++;
138138
}
139139
}
@@ -145,15 +145,15 @@ static void BasicBench_whatwg(benchmark::State &state) {
145145
collector.start();
146146
for (const std::pair<std::string, std::string> &url_strings :
147147
url_examples) {
148-
whatwg::url base;
149-
whatwg::url *base_ptr = nullptr;
148+
upa::url base;
149+
upa::url *base_ptr = nullptr;
150150
if (!url_strings.second.empty()) {
151-
if (whatwg::success(base.parse(url_strings.second, nullptr))) {
151+
if (upa::success(base.parse(url_strings.second, nullptr))) {
152152
base_ptr = &base;
153153
}
154154
}
155-
whatwg::url url;
156-
if (whatwg::success(url.parse(url_strings.first, base_ptr))) {
155+
upa::url url;
156+
if (upa::success(url.parse(url_strings.first, base_ptr))) {
157157
success++;
158158
}
159159
}

0 commit comments

Comments
 (0)