From 63599c719d8e4e09548546bb366a849ef40c602b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 9 Jun 2024 17:54:57 +0200 Subject: feat: add low-memory mode --- internal/importer/main_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 internal/importer/main_test.go (limited to 'internal/importer/main_test.go') diff --git a/internal/importer/main_test.go b/internal/importer/main_test.go new file mode 100644 index 0000000..bbb91a3 --- /dev/null +++ b/internal/importer/main_test.go @@ -0,0 +1,26 @@ +package importer + +import ( + "log/slog" + "searchix/internal/config" + "searchix/internal/index" + "testing" +) + +var cfg = config.DefaultConfig + +func BenchmarkImporterLowMemory(b *testing.B) { + tmp := b.TempDir() + cfg.LogLevel = slog.LevelDebug + _, write, _, err := index.OpenOrCreate(tmp, false, &index.Options{ + LowMemory: true, + }) + if err != nil { + b.Fatal(err) + } + + err = Start(&cfg, write, false, &[]string{"nixpkgs"}) + if err != nil { + b.Fatal(err) + } +} -- cgit 1.4.1