Tweak Console's read buffer size (dotnet/corefx#36212)
Unlike most buffer sizes throughout .NET, where buffer size primarily impacts performance, the size used for the Console's read buffer actually impacts visible functionality to an end user. On Windows, when ReadFile/Console are called to read from a cmd window configured in the default fashion, the size of the buffer passed in determines how long a line can be typed by the user; the shorter the buffer, the less the user will be able to type. Currently .NET uses a buffer of size 256, which ends up meaning a user can't type a line longer than 254 characters.
There is also a performance impact to the buffer size of the read buffer, in that (in particular for redirected input where the input might be coming from a large file) the smaller the buffer the more reads are required to consume the contents of the file. In local measurements, reading a 365M text file with Console.ReadLine took ~6s with a 256 char buffer and ~1.3s with a 4K char buffer (a 16K char buffer improved on that only slightly, at around ~1.1s). Changing the size of the write buffers doesn't have a significant impact in contrast, as Console is configured to flush automatically on every read.
In experimenting with other languages/environments, I found that VC++, Go, and Rust by default all appear to use a 4K buffer (it looks like Python defaults to a 16K buffer).
Given all this, I'm changing Console's read buffer to be 4096 chars instead of 256 chars. I've left the rest of the buffer sizes at 256, but consolidated some of the constants.
If a developer wants a larger or smaller size, they can effectively change it with:
```C#
Console.SetIn(new StreamReader(Console.OpenStandardInput(), Encoding.UTF8, false, BufferSize));
```
Commit migrated from https://github.com/dotnet/corefx/commit/
f37461280a3c843000aa79642ba700baa5a1fc30