Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

This is well answered in this StackOverflow questionin this StackOverflow question.

  • keep the track of the file offset before the read()

  • after the read(), call fadvise(POSIX_FADV_DONTNEED) on the range of data [...]

  • for best results, you have to read the data in page-aligned blocks. The I/O cache is page based, and the fadvise() maps the specified data range into the list of pages. The misalignment would cause extra read()s (and harm performance) but otherwise is harmless.

You don't want to read ahead if you optimize for memory. You just want to read. A disk will operate sequentially if you read, without any need to tell it to pretty please stream the data.

This is well answered in this StackOverflow question.

  • keep the track of the file offset before the read()

  • after the read(), call fadvise(POSIX_FADV_DONTNEED) on the range of data [...]

  • for best results, you have to read the data in page-aligned blocks. The I/O cache is page based, and the fadvise() maps the specified data range into the list of pages. The misalignment would cause extra read()s (and harm performance) but otherwise is harmless.

You don't want to read ahead if you optimize for memory. You just want to read. A disk will operate sequentially if you read, without any need to tell it to pretty please stream the data.

This is well answered in this StackOverflow question.

  • keep the track of the file offset before the read()

  • after the read(), call fadvise(POSIX_FADV_DONTNEED) on the range of data [...]

  • for best results, you have to read the data in page-aligned blocks. The I/O cache is page based, and the fadvise() maps the specified data range into the list of pages. The misalignment would cause extra read()s (and harm performance) but otherwise is harmless.

You don't want to read ahead if you optimize for memory. You just want to read. A disk will operate sequentially if you read, without any need to tell it to pretty please stream the data.

added 189 characters in body
Source Link
kubanczyk
  • 1.3k
  • 9
  • 19

This is well answered in this StackOverflow question.

  • keep the track of the file offset before the read()

  • after the read(), call fadvise(POSIX_FADV_DONTNEED) on the range of data [...]

  • for best results, you have to read the data in page-aligned blocks. The I/O cache is page based, and the fadvise() maps the specified data range into the list of pages. The misalignment would cause extra read()s (and harm performance) but otherwise is harmless.

You don't want to read ahead if you optimize for memory. You just want to read. A disk will operate sequentially if you read, without any need to tell it to pretty please stream the data.

This is well answered in this StackOverflow question.

  • keep the track of the file offset before the read()

  • after the read(), call fadvise(POSIX_FADV_DONTNEED) on the range of data [...]

  • for best results, you have to read the data in page-aligned blocks. The I/O cache is page based, and the fadvise() maps the specified data range into the list of pages. The misalignment would cause extra read()s (and harm performance) but otherwise is harmless.

This is well answered in this StackOverflow question.

  • keep the track of the file offset before the read()

  • after the read(), call fadvise(POSIX_FADV_DONTNEED) on the range of data [...]

  • for best results, you have to read the data in page-aligned blocks. The I/O cache is page based, and the fadvise() maps the specified data range into the list of pages. The misalignment would cause extra read()s (and harm performance) but otherwise is harmless.

You don't want to read ahead if you optimize for memory. You just want to read. A disk will operate sequentially if you read, without any need to tell it to pretty please stream the data.

Source Link
kubanczyk
  • 1.3k
  • 9
  • 19

This is well answered in this StackOverflow question.

  • keep the track of the file offset before the read()

  • after the read(), call fadvise(POSIX_FADV_DONTNEED) on the range of data [...]

  • for best results, you have to read the data in page-aligned blocks. The I/O cache is page based, and the fadvise() maps the specified data range into the list of pages. The misalignment would cause extra read()s (and harm performance) but otherwise is harmless.