From a7b1d8653378bb114558a92737757c3fed6e34e2 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 18 Feb 2022 12:27:46 +0200 Subject: [PATCH] make cidset (in memory) visitors smarter; no need to ever visit unitary objects --- blockstore/splitstore/visitor.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/blockstore/splitstore/visitor.go b/blockstore/splitstore/visitor.go index 9dfbb78e7..4a78f1db1 100644 --- a/blockstore/splitstore/visitor.go +++ b/blockstore/splitstore/visitor.go @@ -26,6 +26,10 @@ type tmpVisitor struct { var _ ObjectVisitor = (*tmpVisitor)(nil) func (v *tmpVisitor) Visit(c cid.Cid) (bool, error) { + if isUnitaryObject(c) { + return false, nil + } + return v.set.Visit(c), nil } @@ -45,6 +49,10 @@ func newConcurrentVisitor() *concurrentVisitor { } func (v *concurrentVisitor) Visit(c cid.Cid) (bool, error) { + if isUnitaryObject(c) { + return false, nil + } + v.mx.Lock() defer v.mx.Unlock()