Skip to content

Commit 87c3476

Browse files
author
Dan Lecocq
committed
Add a benchmark for punycode -> unpunycode round trip.
1 parent 7dc5ac1 commit 87c3476

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bench.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ int main(int argc, char* argv[]) {
4444
size_t runs = 5;
4545

4646
Url::Url base_url(base);
47-
std::string full = Url::Url(relative).relative_to(base_url).str();
47+
Url::Url full_url = Url::Url(relative).relative_to(base_url);
48+
std::string full = full_url.str();
4849

4950
bench("parse", count, runs, [full]() {
5051
Url::Url parsed(full);
@@ -65,4 +66,8 @@ int main(int argc, char* argv[]) {
6566
bench("parse + punycode", count, runs, [full]() {
6667
Url::Url(full).punycode();
6768
});
69+
70+
bench("punycode + unpunycode", count, runs, [full_url]() mutable {
71+
full_url.punycode().unpunycode();
72+
});
6873
}

0 commit comments

Comments
 (0)