docs: function diffWithMap(
    parent,
    children,
    oldChildren,
    newStart,
    newEnd,
    oldStart,
    oldEnd
  ) {
    var keymap = {},
      unkeyed = [],
      idxUnkeyed = 0,
      ch,
      oldCh,
      k,
      idxInOld,
      key;
  
    var newLen = newEnd - newStart + 1;
    var oldLen = oldEnd - oldStart + 1;
    var minLen = Math.min(newLen, oldLen);
    var tresh = Array(minLen + 1);
    tresh[0] = -1;
  
    for (var i = 1; i < tresh.length; i++) {
      tresh[i] = oldEnd + 1;
    }
    var link = Array(minLen);
  
    for (i = oldStart; i <= oldEnd; i++) {
      oldCh = oldChildren[i];
      key = oldCh.key;
      if (key != null) {
        keymap[key] = i;
      } else {
        unkeyed.push(i);
      }
    }
  
    for (i = newStart; i <= newEnd; i++) {
      ch = children[i];
      idxInOld = ch.key == null ? unkeyed[idxUnkeyed++] : keymap[ch.key];
      if (idxInOld != null) {
        k = findK(tresh, idxInOld);
        if (k >= 0) {
          tresh[k] = idxInOld;
          link[k] = { newi: i, oldi: idxInOld, prev: link[k - 1] };
        }
      }
    }
  
    k = tresh.length - 1;
    while (tresh[k] > oldEnd) k--;
  
    var ptr = link[k];
    var diff = Array(oldLen + newLen - k);
    var curNewi = newEnd,
      curOldi = oldEnd;
    var d = diff.length - 1;
    while (ptr) {
      const { newi, oldi } = ptr;
      while (curNewi > newi) {
        diff[d--] = INSERTION;
        curNewi--;
      }
      while (curOldi > oldi) {
        diff[d--] = DELETION;
        curOldi--;
      }
      diff[d--] = PATCH;
      curNewi--;
      curOldi--;
      ptr = ptr.prev;
    }
    while (curNewi >= newStart) {
      diff[d--] = INSERTION;
      curNewi--;
    }
    while (curOldi >= oldStart) {
      diff[d--] = DELETION;
      curOldi--;
    }
    applyDiff(parent, diff, children, oldChildren, newStart, oldStart, keymap);
  }