Chris Burke wrote: > I am in two minds on the buffer. It does impact performance, though not > by much. But it means that after the block of 1e6 bytes is read in, it > is immediately copied because it is appended to the tail of the previous > block. So the question is whether this performance hit is worthwhile to > permit the code to be used for stdin or sockets. I don't feel strongly > on this and wonder if there are other opinions on it.
If you want to avoid that copy, you could special case the handling of the line which spans two blocks. In the long run, I suspect the issue with this copy would be latency not performance. Usually the processing of a line involves an order of magnitude more time than copying that line, and the cost of the 1e6 byte copy gets spread over a lot of lines. And if latency is an issue, the proper solution probably involves reducing the buffer size (since filling the buffer will also involve a lot more work than making a copy of it). -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
