Add an ensureRange() call to ChunkedStream_makeSubStream().
By checking if the data is all present before making a substream, we avoid cases where we parse part of a stream and then throw a MissingDataException part-way through, which forces us to later re-read the stream -- possibly multiple times. This is a sizeable performance win for some cases when file loading is slow (e.g. over the web).
This commit is contained in:
parent
57e896d29e
commit
f12d588258
@ -187,6 +187,8 @@ var ChunkedStream = (function ChunkedStreamClosure() {
|
||||
},
|
||||
|
||||
makeSubStream: function ChunkedStream_makeSubStream(start, length, dict) {
|
||||
this.ensureRange(start, start + length);
|
||||
|
||||
function ChunkedStreamSubstream() {}
|
||||
ChunkedStreamSubstream.prototype = Object.create(this);
|
||||
ChunkedStreamSubstream.prototype.getMissingChunks = function() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user