     }
     
     private func _addLines(withOrientation orientation: LineLayer.Orientation, for positionIndexSet: _PositionIndexSet) {
+        let __lengthOf: (LineLayer) -> CGFloat = {
+            switch orientation {
+            case .horizontal:   return self._lengthFor(row:)
+            case .vertical:     return self._lengthFor(column:)
+            }
+        }()
+        
         for positionIndex in positionIndexSet {
             let lineLayer: LineLayer = LineLayer()
             

            lineLayer.strokeColor = self._lineColor(for: lineLayer)
            lineLayer.lineWidth = self.gridLineWidth
            lineLayer.lineDashPattern = self.gridDashPattern as [NSNumber]
            lineLayer.length = self._length(for: lineLayer)
            
            self._lineLayers.append(lineLayer)
            self.addSublayer(lineLayer)

        self._lineLayers.forEach({ line in
            switch line.orientation {
            case .horizontal:
                line.length = self._lengthFor(row: line)
                line.parallelPosition = self._parallelPositionFor(row: line)
                line.orthogonalPosition = self._orthogonalPositionFor(row: line)
            case .vertical:
                line.length = self._lengthFor(column: line)
                line.parallelPosition = self._parallelPositionFor(column: line)
                line.orthogonalPosition = self._orthogonalPositionFor(column: line)
            }
        })
    }
