Speeding Up Line Processing in Bash with mapfile (readarray)
Bash’s mapfile builtin reads a file into an array in one go, cutting runtime and simplifying code compared to the classic while‑read loop. This guide shows how to use mapfile, benchmark the speedup, and when it’s appropriate.