Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.

Commit 74e7af3

Browse files
committed
Using 1024*1024 buffer when converting JSON to Yara
1 parent 7451529 commit 74e7af3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

main.funcs.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const (
1919
INLINE = `(?m)\s*//.*[\n\r][\n\r]?`
2020
BLANKS = `(?m)\s+$`
2121
QUOTES = `"`
22+
MAXBUFF = 1024 * 1024 // If needed Go will take it form RAM.
2223
)
2324

2425
func processFile(fileName string) []*yago.Parser {
@@ -115,8 +116,10 @@ func processInputFile(inputFile string, validJSON bool) []*yago.Parser {
115116
checkErr(err)
116117
defer file.Close()
117118

119+
var buff []byte
120+
118121
scanner := bufio.NewScanner(file)
119-
// scanner.Split(splitBy)
122+
scanner.Buffer(buff, MAXBUFF)
120123

121124
var rules *yago.Parser
122125
for scanner.Scan() {

0 commit comments

Comments
 (0)