On Fri, May 15, 2020 at 08:55:46AM +0100, Dr Iain Maoileoin wrote:
My question is:
What is that line? I dont understand it? Effort input vs output?
Complexity measure, debugging complexity in a 3rd party program?
I think of it less as a line than as a continuum. I am reminded of an input
routine I wrote for a sort several decades ago. Allocate a pointer from one
end of memory, start reading a record into the other end of memory with
something like
while ((c = getchar()) != EOF) if (c == '\n') { /* entire record is now
there */
Very easy to understand, no guesswork about allocating pointers versus
records, and a complete and utter pig. 50% of the processing time of the
entire sort went into loading records. There were 5 or 6 comparisons
being done for every *character* of input (I omitted the bit about
verifying that there was room to store the next character). It might have
made for good reading, but nobody would have used it, because much faster
sorts were already available, and most people *use* code, not *read* it. So
I had to push into uglier territory to get something that worked well
enough to be worth reading.