Files
blocky/lists/list_cache_benchmark_test.go
T

31 lines
708 B
Go

package lists
import (
"context"
"testing"
"github.com/0xERR0R/blocky/config"
)
func BenchmarkRefresh(b *testing.B) {
file1, _ := createTestListFile(b.TempDir(), 100000)
file2, _ := createTestListFile(b.TempDir(), 150000)
file3, _ := createTestListFile(b.TempDir(), 130000)
lists := map[string][]config.BytesSource{
"gr1": config.NewBytesSources(file1, file2, file3),
}
cfg := config.SourceLoading{
Concurrency: 5,
RefreshPeriod: config.Duration(-1),
}
downloader := NewDownloader(config.Downloader{}, nil)
cache, _ := NewListCache(context.Background(), ListCacheTypeDenylist, cfg, lists, downloader)
b.ReportAllocs()
for b.Loop() {
_ = cache.Refresh(context.Background())
}
}