From 362c307f3835588a6d358046fcd1624316a13e1d Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 17 Oct 2016 13:35:24 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/9132 Reviewed-By: James M Snell --- src/node_file.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/node_file.cc b/src/node_file.cc index 70f99c09f6f23a..58abec64f5b118 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -565,8 +565,6 @@ static void InternalModuleReadFile(const FunctionCallbackInfo& args) { CHECK_GE(numchars, 0); if (static_cast(numchars) < kBlockSize) { chars.resize(start + numchars); - } - if (numchars == 0) { break; } offset += numchars;