prefetch#
- anri.io.prefetch(chunks, depth=2)[source]#
Read ahead: produce the items of an iterable in a background thread, up to
depthahead of the consumer.With
stream_sparse(), the next chunk is read and decompressed while the current one is processed, so the disk and the GPU (or CPU) work at the same time instead of in turn. An error in the reader is raised in the consumer.