-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Spanize interop in System.Net.NetworkInformation #35098
Conversation
Tagging subscribers to this area: @dotnet/ncl |
Depends on #35078 |
...aries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SystemTcpConnection.cs
Show resolved
Hide resolved
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.
LGTM
Which bits make it faster and which safer? It looks like it's adding unsafe modifiers (for the fixed) which makes is counter intuitive to be safer from a casual perspective. |
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.
Nice.
The faster part is e.g. not using array marshaling and PtrToStructure, and using sizeof instead of Marshal.SizeOf. The safer part is using span slicing instead of math on pointers, with the spans being bounds checked. |
|
Faster and safer
Faster and safer