tidb icon indicating copy to clipboard operation
tidb copied to clipboard

lightning should cache the result of `columnAPI.Cols()` to improve performance

Open lance6716 opened this issue 1 year ago • 0 comments

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

capture a CPU profile when lightning encodes KV

image

https://github.com/pingcap/tidb/blob/ff2feb6653846b0decd8b1d7cc0a665e128ccf26/br/pkg/lightning/backend/kv/sql2kv.go#L491-L497

some implementations of columnAPI.Cols() just return the slice, like before https://github.com/pingcap/tidb/pull/50062 or after https://github.com/pingcap/tidb/pull/53798. The other will filter and clone the slice.

2. What did you expect to see? (Required)

stable performance for different versions of lightning

3. What did you see instead (Required)

the duration doubles

4. What is your TiDB version? (Required)

at least v6.5.10

lance6716 avatar Oct 17 '24 09:10 lance6716