From 2334e5d75267811950a1a3308fc85ccb019dde02 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Fri, 22 Nov 2024 01:06:05 +0100 Subject: [PATCH] Make std.net.socket.SocketAddress an inline type This removes the need for a heap allocation when getting IP socket addresses. Changelog: performance --- std/src/std/net/socket.inko | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/std/src/std/net/socket.inko b/std/src/std/net/socket.inko index 0edbc979..bd46f101 100644 --- a/std/src/std/net/socket.inko +++ b/std/src/std/net/socket.inko @@ -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 @@ -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 } }