code: function optimizeChunkList(chunkList: Chunk[], minimumOffset: VirtualOffset): Chunk[] {
    chunkList.sort((a, b) => {
      var result = a.chunk_beg.compareTo(b.chunk_beg);
      if (result === 0) {
        result = a.chunk_end.compareTo(b.chunk_end);
      }
      return result;
    });
  
    var newChunks = [];
    chunkList.forEach(chunk => {
      if (chunk.chunk_end.isLessThan(minimumOffset)) {
        return;  // linear index optimization
      }
  
      if (newChunks.length === 0) {
        newChunks.push(chunk);
        return;
      }
  
      var lastChunk = newChunks[newChunks.length - 1];
      if (!doChunksOverlap(lastChunk, chunk) &&
          !areChunksAdjacent(lastChunk, chunk)) {
        newChunks.push(chunk);
      } else {
        if (lastChunk.chunk_end.isLessThan(chunk.chunk_end)) {
          lastChunk.chunk_end = chunk.chunk_end;
        }
      }
    });
  
    return newChunks;
  }
docs: This coalesces adjacent & overlapping chunks to minimize fetches. It also applies the "linear optimization", which can greatly reduce the number of network fetches needed to fulfill a request.