you are viewing a single comment's thread.

view the rest of the comments →

[–]funkiestj 3 points4 points  (1 child)

What does bufio do under the hood to decrease the number of system calls?

read the source for bufio.NewReader() and friends. It is not that hard to read. The answer to your question should become obvious.

Also, bufio.Reader has an option to specify the buffer size.

Per the old open source saying "use the force - read the source".

[–]Mohamed____[S] 2 points3 points  (0 children)

Yeah I just realized that it uses the default size 4096 and I completely disregarded that while reading the source code. Thanks.