pingcap / parser

A MySQL Compatible SQL Parser
Apache License 2.0
1.41k stars 489 forks source link

Optimize parser performance #1373

Open xingyong opened 2 years ago

xingyong commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a recipe for reproducing the error. financeaccount.zip in the attachment,use the go tool pprof profile,will see parser.New() is too hot because of slice allocation. image Maybe, a object pool is proper.

  2. What did you expect to see? Reduce the overhead of make slice

  3. What did you see instead? parser.New() is too hot

  4. What version of TiDB SQL Parser are you using? master, all versions

tangenta commented 2 years ago

The parser instance is expected to be reused.