#27 reduce memory allocations for scanner.Token by using sync.Pool

This commit is contained in:
z7zmey
2018-06-11 02:41:12 +03:00
parent 43451a070f
commit 2737e98559
14 changed files with 5631 additions and 1414 deletions

View File

@@ -117,3 +117,13 @@ func firstNode(nn []node.Node) node.Node {
func isDollar(r rune) bool {
return r == '$'
}
func (p *Parser) returnTokenToPool(yyDollar []yySymType, yyVAL *yySymType) {
for i := 1; i < len(yyDollar); i++ {
if yyDollar[i].token != nil {
p.TokenPool.Put(yyDollar[i].token)
}
yyDollar[i].token = nil
}
yyVAL.token = nil
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff