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

Punycode speed improvements #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dlecocq
Copy link
Contributor

@dlecocq dlecocq commented Jul 28, 2016

I had this hanging around on a branch, and I figured I should pull it forward now rather than let linger. A rough benchmark using the input "http://日本.co.jp" "/page":

Old:
Benchmarking parse + punycode with 1000000 per run:
  Average: 1043.73 ms
     Rate: 958.101 k-iter / s
Benchmarking punycode + unpunycode with 1000000 per run:
  Average: 1566.77 ms
     Rate: 638.256 k-iter / s

New:
Benchmarking parse + punycode with 1000000 per run:
  Average: 727.279 ms
     Rate: 1374.99 k-iter / s
Benchmarking punycode + unpunycode with 1000000 per run:
  Average: 946.035 ms
     Rate: 1057.04 k-iter / s

@b4hand @tammybailey @lindseyreno

@@ -10,6 +10,16 @@ namespace Url

std::string& Punycode::encode(std::string& str)
{
std::string output;
encode(output, str.cbegin(), str.cend());
str.assign(output);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For C++, I'd just use the assignment operator. I don't know if this has been rebased to include that change or not.

@dlecocq dlecocq force-pushed the dan/punycode-speed-improvements branch from 8f10f02 to 9f454eb Compare August 2, 2016 22:33
{
std::string output;
decode(output, str.cbegin(), str.cend());
str.assign(output);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing about assignment operator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants