Skip to content

Commit

Permalink
makes the scanner buffer larger
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Sep 30, 2023
1 parent 948cd16 commit bb7977c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions cmds/mcla/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ func analysisAndOutput(file string){
}
defer fd.Close()
resCh, errCh := analyzeLogErrors(fd)
if err != nil {
printf("Error when analyzing file %q: %v", file, err)
os.Exit(1)
}
encoder := json.NewEncoder(os.Stdout)
encoder.SetEscapeHTML(false)
encoder.SetIndent("", " ")
Expand Down
4 changes: 3 additions & 1 deletion scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ type lineScanner struct {
}

func newLineScanner(r io.Reader)(*lineScanner){
bs := bufio.NewScanner(r)
bs.Buffer(make([]byte, 256 * 1024), 1024 * 1024) // 256KB per line, large enough?
return &lineScanner{
count: 0,
Scanner: bufio.NewScanner(r),
Scanner: bs,
}
}

Expand Down

0 comments on commit bb7977c

Please sign in to comment.