On Fri, 2 Aug 2002 23:55:42 +0900
"Berger, Daniel" <djberge / qwest.com> wrote:

> I proposed this in my last solution, though it doesn't grab a block of data
> first.  I know the source for tail does this, but if we're counting char by
> char anyway, how does first grabbing a 4k block (or whatever) help?

Say you wanted to tail 100,000 lines before your tail -f . Given 80 chars
per line, thats 8,000,000 seeks and reads, vs 2000 seeks and reads for
reading in 4k chunks. The comparison for c == "\n" gets done the same
# of time in each version, so unless reading in 4k chunks with one
seek/read vs reading in the same with 4000 seeks/reads is slower
(low memory, perhaps), I'd think the chunked version should be much
faster.

Or am I off base here?

----------------------------------------------------------------------
| Jim Hranicky, Senior SysAdmin                   UF/CISE Department |
| E314D CSE Building                            Phone (352) 392-1499 |
| jfh / cise.ufl.edu                      http://www.cise.ufl.edu/~jfh |
----------------------------------------------------------------------

"Given a choice between a complex, difficult-to-understand, disconcerting
 explanation and a simplistic, comforting one, many prefer simplistic
 comfort if it's remotely plausible, especially if it involves blaming
 someone else for their problems."
                                                -- Bob Lewis, _Infoworld_