digitalmars.D.learn - How Performance down slow it is using UFCS friendly function?
- Marcone (12/12) Nov 20 2020 // Função receive()
- Paul Backus (5/17) Nov 20 2020 Calling a function with or without UFCS makes absolutely no
// 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?
Nov 20 2020
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)`.
Nov 20 2020