Skip to content

Commit

Permalink
Make std.net.socket.SocketAddress an inline type
Browse files Browse the repository at this point in the history
This removes the need for a heap allocation when getting IP socket
addresses.

Changelog: performance
  • Loading branch information
yorickpeterse committed Nov 27, 2024
1 parent 8271082 commit 2334e5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions std/src/std/net/socket.inko
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ trait RawSocketOperations {
}

# An IPv4 or IPv6 socket address.
class pub SocketAddress {
class pub inline SocketAddress {
# The IPv4/IPv6 address of this socket address.
let pub @ip: IpAddress

Expand All @@ -96,7 +96,7 @@ class pub SocketAddress {

impl Equal[ref SocketAddress] for SocketAddress {
# Returns `true` if `self` and `other` are the same.
fn pub ==(other: ref SocketAddress) -> Bool {
fn pub inline ==(other: ref SocketAddress) -> Bool {
@ip == other.ip and @port == other.port
}
}
Expand Down

0 comments on commit 2334e5d

Please sign in to comment.