tikv / client-go

Go client for TiKV
Apache License 2.0
282 stars 222 forks source link

membuffer: implement cache for ART #1470

Closed you06 closed 1 month ago

you06 commented 1 month ago

ref pingcap/tidb#55287

ART can also benefit from the cache of last visited leaf, this PR implement the cache, it's almost same as RBT's implementation.

The test result of new added BenchmarkMemBufferCache:

// RBT, with cache, 1 cache-miss and 10 cache-hits for each key
BenchmarkMemBufferCache/RBT
BenchmarkMemBufferCache/RBT-32          10000000               185.9 ns/op             0 B/op          0 allocs/op

// master, no cache, 11 cache-miss for each key
BenchmarkMemBufferCache/ART
BenchmarkMemBufferCache/ART-32          10000000               223.3 ns/op             0 B/op          0 allocs/op

// this PR, with cache, 1 cache-miss and 10 cache-hits for each key
BenchmarkMemBufferCache/ART
BenchmarkMemBufferCache/ART-32          10000000               126.6 ns/op             0 B/op          0 allocs/op
ti-chi-bot[bot] commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, ekexium

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/tikv/client-go/blob/master/OWNERS)~~ [cfzjywxk,ekexium] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
ti-chi-bot[bot] commented 1 month ago

[LGTM Timeline notifier]

Timeline:

you06 commented 1 month ago

A benchmark result of its effect in TiDB's use case would be more convincing.

Little improvement, see TiDB's PR.