http://d.puremagic.com/issues/show_bug.cgi?id=3763



--- Comment #3 from Andrei Alexandrescu <and...@metalanguage.com> 2010-02-01 
22:30:44 PST ---
(In reply to comment #2)
> Well, the problem is pretty clear.  It's in std.stdio.readlnImpl().  In the
> unbuffered I/O routine in the DIGITAL_MARS_STDIO version block, we basically 
> do
> the following in pseudocode:
> 
> buf = readNext64Bytes();
> buf ~= readRest();  // Recurse.

That's Walter's code :o).

> We're effectively prepending to our result in 64-byte increments.

Ouch.

>  Therefore,
> buf is reallocated once for every 64 bytes once we hit unbuffered I/O.  Also
> note that the use of O(N) stack space causes stack overflows for very long
> lines (around 700 KB+).
> 
> The problem is that, from looking at the rest of the code, all the other
> routines for different OS's and I/O libs are implemented the obvious way, 
> using
> plain old array appending, which makes me believe that this one is different
> for a (unknown to me and probably relatively obscure) reason.  Why was the
> unbuffered I/O routine in the DIGITAL_MARS_STDIO version block coded in such 
> an
> odd way in the first place?

I recall Walter wrote that code, and he wrote it in a hurry. We were under
deadline pressure. I personally find that code extremely bulky and difficult to
follow, and would like to see it simplified.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to