[DGD] File access question
Noah Gibbs
noah_gibbs at yahoo.com
Sat Jul 14 00:34:02 CEST 2007
The trick to more quickly read in just part of a file is to know where to
seek to. Two simple-ish ways to do that:
* Store an index of line starts so that you can quickly seek to the beginning
of a line (N). This requires keeping an index up to date, and you have to load
it before you can read the file.
* Have fixed-length lines. Then you don't need an index, you can just do a
multiply to find the start offset.
--- Kurt Nordstrom <kurt at blar.net> wrote:
> Yes, the file format is totally up to me. Do you have some suggestions in
> that regard?
>
> -Kurt
>
> > Do you control the file format? This could make reading 200 random
> > entries
> > easier.
> >
> > Yes, you'll probably want to do this over multiple invocations to avoid
> > running out of ticks. If you have enough privilege it's also possible to
> > do
> > this within a tick-unlimited rlimits() statement, but that's only possible
> > in
> > certain cases.
> >
> ___________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd
>
____________________________________________________________________________________
Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
More information about the DGD
mailing list