Skip to content

Commit

Permalink
Add a benchmark for punycode -> unpunycode round trip.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Lecocq committed Jul 28, 2016
1 parent 3c1c094 commit 0fac174
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ int main(int argc, char* argv[]) {
size_t runs = 5;

Url::Url base_url(base);
std::string full = Url::Url(relative).relative_to(base_url).str();
Url::Url full_url = Url::Url(relative).relative_to(base_url);
std::string full = full_url.str();

bench("parse", count, runs, [full]() {
Url::Url parsed(full);
Expand All @@ -65,4 +66,8 @@ int main(int argc, char* argv[]) {
bench("parse + punycode", count, runs, [full]() {
Url::Url(full).punycode();
});

bench("punycode + unpunycode", count, runs, [full_url]() mutable {
full_url.punycode().unpunycode();
});
}

0 comments on commit 0fac174

Please sign in to comment.