Skip to content

Commit

Permalink
OPT: read buffer for addFromArchive
Browse files Browse the repository at this point in the history
  • Loading branch information
parf committed Jan 15, 2019
1 parent 6884d44 commit 797283e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions php/BigPack.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ function addFromArchive() : int
@$this->stat['known-files']++;
continue;
}
[$data, $archive_data_hash, $flags] = $from_archive->_ReadOffset($file_offset);
[$data, $archive_data_hash, $flags] = $from_archive->_readOffset($file_offset);
if ($archive_data_hash != $data_hash) {
$this->_packFinish();
Util::error("archive filename: $file data_hash mismatch");
Expand Down Expand Up @@ -606,7 +606,7 @@ function _write(string $file, string $index, $data)
static $data_buffer = [];
static $count = 0;
static $size = 0;

if ($file)
$files[] = $file;
if ($index)
Expand Down Expand Up @@ -1216,6 +1216,7 @@ function _readOffset(int $offset) : array
if (!file_exists($this->dir . Core::DATA))
Util::error("Bigpack DATA not found in $this->dir");
$this->fh_data = Util::openLock($this->dir . Core::DATA);
stream_set_read_buffer($this->fh_data, 655360);
}
return static::__readOffset($this->fh_data, $offset);
}
Expand Down

0 comments on commit 797283e

Please sign in to comment.