
Stephen Tetley wrote:
hi wren
Where I've used it, random access does seem conceptual more satisfactory than trying to avoid it.
I was thinking more about performance issues (avoiding disk seeks) which would also alleviate the problem of needing random access when it's not available.
For complex formats e.g. PECOFF or TrueType, you might only want to parse certain tables [*]. After parsing the index table you could build a list of parsers to run sequentially on the body of the file (including parsers that just drop unwanted tables), but this seems too much work (and too much to go wrong)
Even still, you could linearize the access in order to minimize seeking back and forth. The linearization could even be done automatically by having the table of what needs backpatching also serve as a work queue (when done with a block, seek to the closest next block; when the queue is empty, you're done). The backpatching queue also preserves structure sharing. Perhaps I've just been parsing too many multigigabyte files lately... :) -- Live well, ~wren