I suggest that it might benefit you to understand cost of IO. In most systems the IO cost dwarfs the CPU cost of optimizations like these. I am not saying it never matters - I have significant HFT experience and sone HPC - but in MOST cases it holds true.
So micro optimizing the CPU usually has little effect on total runtime. Broken algs, ON^2, are another story. > On May 3, 2019, at 9:38 AM, Louki Sumirniy <louki.sumirniy.stal...@gmail.com> > wrote: > > There is a big difference between the parameters of these two functions. One > is a slice of interface, the other is only a a single string parameter. fmt > print functions all have nasty messy interface switching and reflection > internally hence the significant overhead. > > A lot of people clearly don't know this, also - there is a builtin print() > and println() function in Go. If the output is stdout, these are probably the > most efficient ways to thow strings at it. Clearly the same goes for > io.WriteString, but with the option of using another Writer instead of stdout. > > On Monday, 22 April 2019 03:13:22 UTC+2, codi...@gmail.com wrote: >> >> Hi gophers! Just wondering if in a Handler I should (w is the >> http.ResponseWriter): >> >> fmt.Fprint(w, "Hello world") >> >> or is it better to >> >> io.WriteString(w, "Hello world") >> >> or is it the same if fmt.Fprint already uses WriteString internally? > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.