Summary: Another File.byChunk()
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos

--- Comment #0 from 2010-09-13 04:18:49 PDT ---
std.stdio.File.byChunk reuses the content of buffer across calls, but I think
the first call performs an allocation. Tango has shown that an important factor
for the performance of D programs is to minimize memory allocations.

So an overloaded byChunk may be added with a signature similar to (so the older
byChunk() is not removed, this is added):
chunks byChunk(void[] buffer);

So you may use it like this and avoid the first memory allocation too:

ubyte[4096] buffer;
foreach (ubyte[] chunk; stdin.byChunk(buffer[])) {
    ... use chunk ...

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to