Skip to content

Commit

Permalink
fs: improve readFile performance
Browse files Browse the repository at this point in the history
This increases the maximum buffer size per read to 256kb when using
`fs.readFile`. This is important to improve the read performance for
bigger files.

Refs: nodejs#25741
  • Loading branch information
BridgeAR committed Apr 3, 2019
1 parent dd0d6df commit 0d49428
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/fs/read_file_context.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class ReadFileContext {
} else {
buffer = this.buffer;
offset = this.pos;
length = Math.min(kReadFileBufferLength, this.size - this.pos);
// Read up to 256kb.
length = Math.min(256 * 1024, this.size - this.pos);
}

const req = new FSReqCallback();
Expand Down

0 comments on commit 0d49428

Please sign in to comment.