Skip to content

ENH: Create index on reads, not on seeks #74

@pauldmccarthy

Description

@pauldmccarthy

Currently the index is built:

  • On calls to zran_seek(n) - the index is bulit to cover up to position n in the uncompressed data
  • On successive calls to zran_read - when reading from position 0, one seek point is created at the beginning of the stream, but then no more points are created. If another call to zran_read is then made, the index is built to cover up to the position that the previous zran_read call finished - data is re-read and re-decompressed from the beginning of the file/stream. Then the read is initialised from that point.

This is complicated and inefficient - zran_seek should just update an internal offset into the uncompressed data, without doing anything else. Then zran_read should both read data and build the index in a single pass.

To support pre-generating an index, without reading any data, zran_read could allow buf to be NULL, which would cause it to read/build the index, but not copy any data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions