Comment
Comment by marginalia_nu
Premature optimization may sometimes be unadvisable, but in this case the optimized version uses half the memory, is two orders of magnitude faster, and doesn't let your users DOS you by triggering huge file reads on each request.