Skip to content

Commit 362c307

Browse files
bnoordhuisevanlucas
authored andcommitted
src: speed up module loading, skip EOF read
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 <[email protected]>
1 parent c6e429a commit 362c307

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

src/node_file.cc

-2
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,6 @@ static void InternalModuleReadFile(const FunctionCallbackInfo<Value>& args) {
565565
CHECK_GE(numchars, 0);
566566
if (static_cast<size_t>(numchars) < kBlockSize) {
567567
chars.resize(start + numchars);
568-
}
569-
if (numchars == 0) {
570568
break;
571569
}
572570
offset += numchars;

0 commit comments

Comments
 (0)