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

IDNA encoding of hostname #95

Closed
Glandos opened this issue Jun 7, 2017 · 5 comments
Closed

IDNA encoding of hostname #95

Glandos opened this issue Jun 7, 2017 · 5 comments

Comments

@Glandos
Copy link

Glandos commented Jun 7, 2017

  • uvloop version: 0.8.0
  • Python version: 3.5
  • Platform: Debian GNU/Linux testing
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: I don't know

Commit 1d5ae0b introduces IDNA encoding. While this is a good solution for FQDN hostnames, this is really a performance killer when sending a lot of small packets using lots of IP address (use case in boramalper/magnetico#92). On my CPU, the IDNA encoding is taking ~5% of the whole program execution, and more than 75% of the sendto method call.

The main issue here is that the sendto call is done with address given with the call to datagram_received, so uvloop should be already aware that the hostname is an IP address.
I guess that datagram_received cannot return an encoded hostname, but the idea is here.

@asvetlov
Copy link
Contributor

asvetlov commented Jun 7, 2017

You could skip encoding by sending host parameter as bytes, isn't it?

@Glandos
Copy link
Author

Glandos commented Jun 7, 2017

Yes, but the host parameter is the one received from datagram_received, so it theoretically could be a FQDN.
EDIT: I don't know if there is a fast test to tell if the host is an IP address or not.

@1st1
Copy link
Member

1st1 commented Jun 7, 2017

EDIT: I don't know if there is a fast test to tell if the host is an IP address or not.

Yes, there's a fast test. I'll look into this.

1st1 added a commit that referenced this issue Nov 13, 2017
@1st1
Copy link
Member

1st1 commented Nov 13, 2017

Fixed in master. Will be in 0.9.0 release (soon)

@1st1 1st1 closed this as completed Nov 13, 2017
@1st1
Copy link
Member

1st1 commented Nov 27, 2017

Please try uvloop v0.9.0.

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

No branches or pull requests

3 participants