Skip to content

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

@lance6716

Description

@lance6716

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

func (kvcodec *tableKVEncoder) getActualDatum(rowID int64, colIndex int, inputDatum *types.Datum) (types.Datum, error) {
var (
value types.Datum
err error
)
cols := kvcodec.tbl.Cols()

some implementations of columnAPI.Cols() just return the slice, like before #50062 or after #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

Metadata

Metadata

Labels

affects-6.5This bug affects the 6.5.x(LTS) versions.component/lightningThis issue is related to Lightning of TiDB.good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.severity/moderatetype/bugThe issue is confirmed as a bug.type/regression

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions