diff --git a/pkg/workflow/compiler.go b/pkg/workflow/compiler.go index de36d6284ca..b941355f43f 100644 --- a/pkg/workflow/compiler.go +++ b/pkg/workflow/compiler.go @@ -13,7 +13,7 @@ import ( "github.com/github/gh-aw/pkg/console" "github.com/github/gh-aw/pkg/logger" "github.com/github/gh-aw/pkg/stringutil" - "github.com/goccy/go-yaml" + "go.yaml.in/yaml/v3" ) var log = logger.New("workflow:compiler") diff --git a/pkg/workflow/compiler_performance_benchmark_test.go b/pkg/workflow/compiler_performance_benchmark_test.go index 898acd4aee3..0ea98c9e505 100644 --- a/pkg/workflow/compiler_performance_benchmark_test.go +++ b/pkg/workflow/compiler_performance_benchmark_test.go @@ -40,6 +40,10 @@ Analyze the issue: ${{ steps.sanitized.outputs.text }} compiler := NewCompiler() + // Warm up: run once before timing to prime one-time caches (schema compilation, etc.) + _ = compiler.CompileWorkflow(testFile) + + b.ResetTimer() b.ReportAllocs() for b.Loop() { _ = compiler.CompileWorkflow(testFile) @@ -98,6 +102,10 @@ Review the pull request: ${{ github.event.pull_request.number }} compiler := NewCompiler(WithNoEmit(true)) + // Warm up: run once before timing to prime one-time caches (schema compilation, etc.) + _ = compiler.CompileWorkflow(testFile) + + b.ResetTimer() b.ReportAllocs() for b.Loop() { _ = compiler.CompileWorkflow(testFile) @@ -145,6 +153,10 @@ Review and test the pull request with multiple tools. compiler := NewCompiler(WithNoEmit(true)) + // Warm up: run once before timing to prime one-time caches (schema compilation, etc.) + _ = compiler.CompileWorkflow(testFile) + + b.ResetTimer() b.ReportAllocs() for b.Loop() { _ = compiler.CompileWorkflow(testFile) @@ -194,6 +206,11 @@ Standard workflow for memory profiling. compiler := NewCompiler(WithNoEmit(true)) + // Warm up: run once before timing to initialize one-time caches + // (schema compilation, regex caches) so they don't skew per-op metrics. + _ = compiler.CompileWorkflow(testFile) + + b.ResetTimer() b.ReportAllocs() // Track memory allocations @@ -232,6 +249,10 @@ Test parsing performance. compiler := NewCompiler() + // Warm up: prime the schema compilation cache before timed measurement. + _, _ = compiler.ParseWorkflowFile(testFile) + + b.ResetTimer() b.ReportAllocs() for b.Loop() { _, _ = compiler.ParseWorkflowFile(testFile) @@ -274,6 +295,10 @@ Test validation performance. compiler := NewCompiler(WithNoEmit(true)) compiler.SetStrictMode(true) + // Warm up: prime the schema compilation cache before timed measurement. + _ = compiler.CompileWorkflow(testFile) + + b.ResetTimer() b.ReportAllocs() for b.Loop() { _ = compiler.CompileWorkflow(testFile) diff --git a/pkg/workflow/schema_validation.go b/pkg/workflow/schema_validation.go index 05adaa458c7..cb64379f25b 100644 --- a/pkg/workflow/schema_validation.go +++ b/pkg/workflow/schema_validation.go @@ -45,8 +45,8 @@ import ( "strings" "sync" - "github.com/goccy/go-yaml" "github.com/santhosh-tekuri/jsonschema/v6" + "go.yaml.in/yaml/v3" ) var schemaValidationLog = newValidationLogger("schema")