Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce coprocessor request cost #37286

Closed
tiancaiamao opened this issue Aug 23, 2022 · 0 comments · Fixed by #37288
Closed

Reduce coprocessor request cost #37286

tiancaiamao opened this issue Aug 23, 2022 · 0 comments · Fixed by #37288
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@tiancaiamao
Copy link
Contributor

Enhancement

image

ranges := make([]*coprocessor.KeyRange, 0, r.Len())
r.Do(func(ran *kv.KeyRange) {
ranges = append(ranges, &coprocessor.KeyRange{
Start: ran.StartKey,
End: ran.EndKey,
})
})
return ranges

Since kv.KeyRange and coprocessor.KeyRange definition are different, we need to make object allocation to send coprocessor.Request...

We can avoid object allocation if kv.KeyRange and coprocessor.KeyRange are the same.
Actually, they are both

type KeyRange struct {
    StartKey []byte
    EndKey []byte
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
1 participant