mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #5316 from ajityagaty/too_many_allocs
mvcc: Reduce number of allocs in PUT when watchableStore has no watchers.
This commit is contained in:
commit
fa1e28102e
@ -78,6 +78,10 @@ func (wb watcherBatch) add(w *watcher, ev mvccpb.Event) {
|
|||||||
// newWatcherBatch maps watchers to their matched events. It enables quick
|
// newWatcherBatch maps watchers to their matched events. It enables quick
|
||||||
// events look up by watcher.
|
// events look up by watcher.
|
||||||
func newWatcherBatch(wg *watcherGroup, evs []mvccpb.Event) watcherBatch {
|
func newWatcherBatch(wg *watcherGroup, evs []mvccpb.Event) watcherBatch {
|
||||||
|
if len(wg.watchers) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
wb := make(watcherBatch)
|
wb := make(watcherBatch)
|
||||||
for _, ev := range evs {
|
for _, ev := range evs {
|
||||||
for w := range wg.watcherSetByKey(string(ev.Kv.Key)) {
|
for w := range wg.watcherSetByKey(string(ev.Kv.Key)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user