#27 reduce memory allocations for scanner.Token by using sync.Pool
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
2205
php5/php5.go
2205
php5/php5.go
File diff suppressed because it is too large
Load Diff
1574
php5/php5.y
1574
php5/php5.y
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user