code: function prepareMeasureForLine(cm, line) {
      var lineN = lineNo(line);
      var view = findViewForLine(cm, lineN);
      if (view && !view.text)
        view = null;
      else if (view && view.changes)
        updateLineForChanges(cm, view, lineN, getDimensions(cm));
      if (!view)
        view = updateExternalMeasurement(cm, line);
  
      var info = mapFromLineView(view, line, lineN);
      return {
        line: line, view: view, rect: null,
        map: info.map, cache: info.cache, before: info.before,
        hasHeights: false
      };
    }
docs: Measurement can be split in two steps, the set-up work that applies to the whole line, and the measurement of the actual character. Functions like coordsChar, that need to do a lot of measurements in a row, can thus ensure that the set-up work is only done once.