Unverified Commit a126cb57 authored by Anna Henningsen's avatar Anna Henningsen
Browse files

fs: read full size if known in promises.readFile

If we have an estimate of the file size available from the previous
stat call, use that for the size of the first chunk to be read.
This increases performance by reading more data (and, most likely,
all data) at once without incurring memory overhead in most situations.

PR-URL: https://github.com/nodejs/node/pull/37127


Reviewed-By: default avatarAntoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: default avatarColin Ihrig <cjihrig@gmail.com>
Reviewed-By: default avatarDarshan Sen <raisinten@gmail.com>
Reviewed-By: default avatarZijian Liu <lxxyxzj@gmail.com>
Reviewed-By: default avatarBenjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: default avatarJuan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: default avatarLuigi Pinca <luigipinca@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
parent 186feb45
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment