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 authored and evanlucas committed Nov 2, 2016
1 parent c6e429a commit 362c307
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 362c307

Please sign in to comment.