-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-111662: Update socket module to use AC for optimizing performance #111661
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
896060a
change calling convention of socket.htons
wrongnull a06b91d
📜🤖 Added by blurb_it.
blurb-it[bot] 26ebcea
delete news
wrongnull cd3f611
Merge branch 'main' into meth_o-for-htons
wrongnull 0f3ca47
clinic argument for socket.htons
wrongnull d92ddd3
clinic argument for socket.ntohs
wrongnull 144f61c
clinic argument for socket.inet_aton
wrongnull 6ccd817
clinic argument for socket.inet_ntoa
wrongnull a533180
clinic argument for socket.if_nametoindex
wrongnull b1f28f5
clinic argument for socket.ntohl
wrongnull 387725b
clinic argument for socket.htonl
wrongnull 6ea506f
Merge branch 'main' into meth_o-for-htons
wrongnull bc6733b
remove bitwise=True from clinic converter
wrongnull a27a86d
Revert "remove bitwise=True from clinic converter"
wrongnull c62d4e3
Revert "clinic argument for socket.htonl"
wrongnull e55aac5
Revert "clinic argument for socket.ntohl"
wrongnull 39e68a8
Merge branch 'main' into meth_o-for-htons
wrongnull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use AC instead of writing manual parsing.
I got a similar performance gain in my local environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wrongnull
You should take a look at the https://devguide.python.org/development-tools/clinic/ if you're not familiar with Argument Clinic :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure a similar approach can be applied to all other functions with only one argument. If yes, I'll be happy to make such a commit in this branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@corona10 seems ready. clinic argument was also applied to other functions where it was beneficial
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if ValueError is more preferable if negative value is passed to ntohl and htonl functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change the exception type; it will occur in user regression.
Can I know where the type of exception will be changed if AC is applied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exception type will change to
ValueError
fromOverflowError
inhtonl
andntohl
functions after applyingusigned_long
argument converter.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, I would like to recommend not to touch it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I reverted this changes