29-Mar-2014 06:47, Andrei Alexandrescu пишет:
On 3/28/14, 11:40 AM, Dmitry Olshansky wrote:
28-Mar-2014 22:29, Walter Bright пишет:
On 3/28/2014 10:11 AM, Dmitry Olshansky wrote:
WAT? The overhead is in issuing system calls, you'd want to do as
little of them
as possible. Reading byte by byte is an exemplar of idiocy in I/O code.
That's why we have things like byLine().
Which uses C's BUFFERED I/O and it reads from it byte by byte via getc.
Even though sys calls are amortized by C runtime, we have a function
call per byte. No wonder it's SLOW.
byLine doesn't use getc. -- Andrei
Indeed not every version. Linux looks almost OK.
There is still this stuff in empty:
https://github.com/D-Programming-Language/phobos/blob/master/std/stdio.d#L1604
And looking through the code I see that Win64, OSX and FreeBSD versions
still use getc. Win32 hacks right into DMC run-time, and on linux
getdelim is used.
The point about ranges only ever making sense over buffered I/O still
stands. Preferably not C runtime.
--
Dmitry Olshansky