numpy.array() vs numpy.fromiter(): memory‑efficient streaming or fast bulk copy for large iterables?
Goal Convert a large Python iterable (e.g., a list with >10⁷ elements) to a NumPy ndarray while keeping peak memory usage low and avoiding unnecessary latency. Constraints and uncertainty numpy.array() always copies the input, doubling memory temporarily. numpy.asarray() avoids a copy only when the source is already an ndarray, which does not help for pla