From 0ee3117d876ce9142251eaa129f04dc61e8edfe3 Mon Sep 17 00:00:00 2001 From: GordonDiggs Date: Tue, 12 Jan 2016 11:29:35 -0500 Subject: [PATCH] Use process.stdout.write instead of console.log and increase batch size `console.log` does some extra work to construct the output, and because it's already a string, we can save some memory by using `process.stdout.write`. See this issue for more information: https://github.com/nodejs/node/issues/1741#issuecomment-103827443 This is an attempt to remedy the OOM issues when rendering all the issues. Increasing the batch size will also help by reducing the number of GCs. --- bin/eslint.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/eslint.js b/bin/eslint.js index ab32e27c8..31122e6d0 100755 --- a/bin/eslint.js +++ b/bin/eslint.js @@ -194,7 +194,7 @@ var analysisFiles = runWithTiming("buildFileList", function() { function analyzeFiles() { var batchNum = 0 - , batchSize = 1 + , batchSize = 10 , batchFiles , batchReport; @@ -214,7 +214,7 @@ function analyzeFiles() { result.messages.forEach(function(message) { var issueJson = buildIssueJson(message, path); - stdout(issueJson + "\u0000"); + process.stdout.write(issueJson + "\u0000"); }); }); });