From 17bf7e042496a4afcbf6ee7a583378adb3ec502d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 22 Jul 2026 23:52:43 +0300 Subject: =?UTF-8?q?build:=20DTail=20fork=20=E2=80=94=20benchmarks,=20PGO?= =?UTF-8?q?=20tooling,=20Makefile,=20docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed development of the build/benchmark/profiling tooling: - Turbo-vs-normal and per-tool benchmark harnesses under benchmarks/ (with dated baseline and result artifacts preserved), plus MapReduce/SSH/network suites. - Profile-Guided Optimization workflow (internal/tools/pgo lives with the code): Makefile targets (make pgo / pgo-quick / build-pgo), profile generation with non-zero-sample and representativeness guards. - Makefile targets for build, test (unit + integration), lint, vet, benchmarking and profiling; docker config updates. - .gitignore hardened against pgo profiles and accidental integration-test debug/output dumps. Co-Authored-By: Claude Opus 4.8 --- benchmarks/buffer_pool_test.go | 84 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 benchmarks/buffer_pool_test.go (limited to 'benchmarks/buffer_pool_test.go') diff --git a/benchmarks/buffer_pool_test.go b/benchmarks/buffer_pool_test.go new file mode 100644 index 0000000..4ebe8eb --- /dev/null +++ b/benchmarks/buffer_pool_test.go @@ -0,0 +1,84 @@ +package benchmarks + +import ( + "os" + "testing" +) + +// BenchmarkDGrepMultipleFiles tests buffer pooling effectiveness with multiple files +func BenchmarkDGrepMultipleFiles(b *testing.B) { + cleanup := SetupBenchmark(b) + defer cleanup() + + // Create multiple test files + numFiles := 10 + files := make([]string, numFiles) + for i := 0; i < numFiles; i++ { + config := TestDataConfig{ + Size: Small, + Format: SimpleLogFormat, + Compression: NoCompression, + LineVariation: 50, + Pattern: "ERROR", + PatternRate: 10, + } + files[i] = GenerateTestFile(b, config) + defer os.Remove(files[i]) + } + + b.Run("WithTurbo", func(b *testing.B) { + // Turbo boost is enabled by default; clear the disable flag so this + // "WithTurbo" arm genuinely runs with turbo boost on even if a prior + // benchmark left DTAIL_TURBOBOOST_DISABLE set in the process env. + os.Unsetenv("DTAIL_TURBOBOOST_DISABLE") + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + // Process all files + for _, file := range files { + _, err := RunBenchmarkCommand(b, "dgrep", "--plain", "--cfg", "none", "--grep", "ERROR", file) + if err != nil { + b.Fatalf("Failed to run dgrep: %v", err) + } + } + } + }) +} + +// BenchmarkDGrepLargeFile tests performance on a single large file +func BenchmarkDGrepLargeFile(b *testing.B) { + cleanup := SetupBenchmark(b) + defer cleanup() + + config := TestDataConfig{ + Size: Medium, + Format: SimpleLogFormat, + Compression: NoCompression, + LineVariation: 50, + Pattern: "ERROR", + PatternRate: 10, + } + + testFile := GenerateTestFile(b, config) + defer os.Remove(testFile) + + b.Run("WithTurbo", func(b *testing.B) { + // Turbo boost is enabled by default; clear the disable flag so this + // "WithTurbo" arm genuinely runs with turbo boost on even if a prior + // benchmark left DTAIL_TURBOBOOST_DISABLE set in the process env. + os.Unsetenv("DTAIL_TURBOBOOST_DISABLE") + + b.ResetTimer() + b.ReportAllocs() + + for i := 0; i < b.N; i++ { + result, err := RunBenchmarkCommand(b, "dgrep", "--plain", "--cfg", "none", "--grep", "ERROR", testFile) + if err != nil { + b.Fatalf("Failed to run dgrep: %v", err) + } + _ = result + } + }) +} -- cgit v1.2.3