src/vs/editor/common/model/pieceTreeTextBuffer/rbTreeBase.ts/calculateSize
function calculateSize(node: TreeNode): number {
	if (node === SENTINEL) {
		return 0;
	}

	return node.size_left + node.piece.length + calculateSize(node.right);
}