Alexander Viro wrote:
> Hrrrmmmm... No offence, but... where did it come from? Some demented
> LISPer?
Yes, we know which one too :-)
> You *do* realize that such suggestion implies quoting scheme,
> right?
It's not as inefficient as you think.
Instead of naive quoting, say `\' before every delimiter and `\' itself,
think like this:
Each read-in block is quoted by a header saying "this next N bytes is
taken literally", followed by the unquoted data for N bytes.
If this is generated on the fly, we can choose N such that
sizeof(header)+N == 3rd argument to read() [or smaller]. We could
choose other values -- but then we'd have to accept the possibiltity of
padding if the underlying file is truncated while the on-the-fly file is
being read.
This way cat stays fast. There is copying but no significant work
quoting -- and the copying is no more than required anyway to construct
these files on the fly.
> And such quoting will mean
> that cat is not fast anymore - extra copying is not fun, especially for
> situations when you have to run non-trivial loops [cost of unaligned
> memory access is surprisingly high].
Keeping it aligned is easy with my suggestion.
-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/