Skip to content

Commit

Permalink
Prefetch speedup.
Browse files Browse the repository at this point in the history
  • Loading branch information
danilop committed Feb 13, 2014
1 parent 6273a0f commit eea7e43
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion yas3fs
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,11 @@ class YAS3FS(LoggingMixIn, Operations):
prefetch_start = end_interval + 1
prefetch_length = self.buffer_size * self.buffer_prefetch
logger.debug("download prefetch '%s' '%i' '%i'" % (path, prefetch_start, prefetch_length))
self.enqueue_download_data(path, prefetch_start, prefetch_length, prefetch=True)
prefetch_end_interval = min(prefetch_start + prefetch_length, file_size) - 1
if prefetch_start < prefetch_end_interval:
prefetch_interval = [prefetch_start, prefetch_end_interval]
if not data_range.interval.contains(prefetch_interval):
self.enqueue_download_data(path, prefetch_start, prefetch_length, prefetch=True)
logger.debug("read '%s' '%i' '%i' '%s' in range" % (path, length, offset, fh))
break
else:
Expand Down

0 comments on commit eea7e43

Please sign in to comment.