On Saturday, 21 November 2020 at 00:26:03 UTC, Marcone wrote:
// Função receive()
char[] receive(Socket socket, int size = 8192) nothrow {
        try {
                char[] buffer;
                buffer.length = size;
                int rq = socket.receive(buffer);
                return buffer[0..rq];
        } catch(Throwable){return null;}
}


s = new Socket(AddressFamily.INET, SocketType.STREAM);
writeln(s.receive(8192)); // How slow is using as friendly function?

Calling a function with or without UFCS makes absolutely no difference to performance. The compiler will generate the exact same code whether you write `receive(s, 8192)` or `s.receive(8192)`.

Reply via email to