Skip to content

Conversation

@dlecocq
Copy link

@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

std::string& Punycode::encode(std::string& str)
{
std::string output;
encode(output, str.cbegin(), str.cend());
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.

3 participants