Skip to content

Commit

Permalink
Use process.stdout.write instead of console.log and increase batch size
Browse files Browse the repository at this point in the history
`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:
nodejs/node#1741 (comment)

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.
  • Loading branch information
gdiggs committed Jan 12, 2016
1 parent e988605 commit 3c2d193
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ var analysisFiles = runWithTiming("buildFileList", function() {

function analyzeFiles() {
var batchNum = 0
, batchSize = 1
, batchSize = 10
, batchFiles
, batchReport;

Expand All @@ -214,7 +214,7 @@ function analyzeFiles() {

result.messages.forEach(function(message) {
var issueJson = buildIssueJson(message, path);
stdout(issueJson + "\u0000");
process.stdout.write(issueJson + "\u0000");
});
});
});
Expand Down

0 comments on commit 3c2d193

Please sign in to comment.