cache `points.length` in local variable