Skip to content

Commit

Permalink
src: speed up module loading, skip EOF read
Browse files Browse the repository at this point in the history
Stop reading from disk when we read fewer bytes than requested because
the next read will be the zero-sized EOF.

PR-URL: #9132
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
bnoordhuis committed Oct 24, 2016
1 parent d3b1a2b commit 35e8896
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,6 @@ static void InternalModuleReadFile(const FunctionCallbackInfo<Value>& args) {
CHECK_GE(numchars, 0);
if (static_cast<size_t>(numchars) < kBlockSize) {
chars.resize(start + numchars);
}
if (numchars == 0) {
break;
}
offset += numchars;
Expand Down

0 comments on commit 35e8896

Please sign in to comment.