Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: update whatwg_url package to latest commit #539

Merged
merged 1 commit into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmark_header.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <http_parser.h>
#endif
#if ADA_url_whatwg_ENABLED
#include <src/url.h>
#include <upa/url.h>
#endif

#include "ada.h"
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/benchmark_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}
Expand All @@ -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();
Expand All @@ -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();
Expand Down
22 changes: 11 additions & 11 deletions benchmarks/wpt_bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,22 @@ BENCHMARK(BasicBench_AdaURL_url_aggregator);

#if ADA_url_whatwg_ENABLED

#include <src/url.h>
#include <upa/url.h>

static void BasicBench_whatwg(benchmark::State &state) {
volatile size_t success{};
for (auto _ : state) {
for (const std::pair<std::string, std::string> &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++;
}
}
Expand All @@ -145,15 +145,15 @@ static void BasicBench_whatwg(benchmark::State &state) {
collector.start();
for (const std::pair<std::string, std::string> &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++;
}
}
Expand Down
Loading