about summary refs log tree commit diff stats
path: root/internal/importer
diff options
context:
space:
mode:
authorAlan Pearce2024-06-09 17:54:57 +0200
committerAlan Pearce2024-06-09 17:54:57 +0200
commit63599c719d8e4e09548546bb366a849ef40c602b (patch)
tree549336370f77a8a1a3c626fe6bf0118f32baef59 /internal/importer
parent789d0079f84017ddafad763ffba9aadbcd6aa6da (diff)
downloadsearchix-63599c719d8e4e09548546bb366a849ef40c602b.tar.lz
searchix-63599c719d8e4e09548546bb366a849ef40c602b.tar.zst
searchix-63599c719d8e4e09548546bb366a849ef40c602b.zip
feat: add low-memory mode
Diffstat (limited to 'internal/importer')
-rw-r--r--internal/importer/main_test.go26
1 files changed, 26 insertions, 0 deletions
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)
+	}
+}