From f5210092007a0303b5ff0873997a0884afcaa4ed Mon Sep 17 00:00:00 2001 From: Faye Amacker <33205765+fxamacker@users.noreply.github.com> Date: Mon, 13 May 2024 14:58:30 -0500 Subject: [PATCH] Add more comments in BatchPreload --- storage.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/storage.go b/storage.go index 34b3760..045e568 100644 --- a/storage.go +++ b/storage.go @@ -1561,12 +1561,16 @@ func (s *PersistentSlabStorage) getAllChildReferences(slab Slab) ( return references, brokenReferences, nil } +// BatchPreload decodeds and caches slabs of given ids in parallel. +// This is useful for storage health or data validation in migration programs. func (s *PersistentSlabStorage) BatchPreload(ids []SlabID, numWorkers int) error { if len(ids) == 0 { return nil } - minCountForBatchPreload := 11 + // Use 11 for min slab count for parallel decoding because micro benchmarks showed + // performance regression for <= 10 slabs when decoding slabs in parallel. + const minCountForBatchPreload = 11 if len(ids) < minCountForBatchPreload { for _, id := range ids {