#Why does the writer() method on a file take a buffer now?

1 messages · Page 1 of 1 (latest)

pallid vigil
#

Why does the writer() method on a file take a buffer now?

tropic bay
#

because the new interfaces reader/writer make buffering a part of the interface, previously it was an implementation detail, and there was a generic BufferedWriter that added buffering ontop of other implementations.

moving buffering to be part of the interface is generally faster, and the api around it is more convenient, the parts that are implemented anyway, there are probably things that have not been carried over to the new api.

the reason the functions to create readers and writers take a buffer, is caus the interface needs one to work. FYI you can pass a 0 sized buffer &.{} to effecitvely dissable buffering.

pallid vigil
#

i basically just debug print to a file, are there any benefits to having a buffer? how large should the buffer be? (my debug logs are ~5-10m lines)