Repository navigation
perf(decisionindex,gateway): parallelize independent multi-pass /v1/systemone batches and Round-1 brackets - #96
Merged
ghchinoy merged 1 commit intoNov 21, 2026
Conversation
…ystemone batches and Round-1 brackets Multi-pass /v1/systemone adapter requests previously executed every standard slot batch (>8 questions), every wide-option question (>26 options), and every Round-1 bracket batch (>160 options) strictly serially even though EngineOptions.MaxConcurrency (default 4) was already defined. - Add runBounded helper in pkg/decisionindex/engine.go: runs single-task or MaxConcurrency<=1 requests inline (zero goroutine overhead), and dispatches multi-task batches concurrently up to MaxConcurrency with context cancellation on first error. - Parallelize independent standard batches and wide questions in ExecuteSystemOne, and independent Round-1 bracket batches in evaluateWideQuestionTournament (Round-2 Finals still waits on Round 1). - Expose --systemone-max-concurrency / DGEM_SYSTEMONE_MAX_CONCURRENCY (default 4; 1 = serial) in dgem serve and log dgem.systemone.server_ms on gateway adapter spans alongside dgem.systemone.forward_passes. - Add race-tested unit tests in pkg/decisionindex/parallel_passes_test.go covering multi-batch overlap, serial MaxConcurrency=1 mode, wide tournament Round-1 parallelism, and error cancellation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eliminates unnecessary serial execution across independent passes in the
/v1/systemoneadapter while keeping prompts, scoring, and response shapes identical:pkg/decisionindex/engine.go): wires the existingEngineOptions.MaxConcurrency(default4) via a newrunBoundedhelper:MaxConcurrency <= 1run inline with zero goroutine overhead.>8questions) and multiple wide questions (>26options) execute concurrently up toMaxConcurrency.>160options, e.g.,>8brackets) execute concurrently before Round-2 Finals.cmd/serve.go):--systemone-max-concurrency/DGEM_SYSTEMONE_MAX_CONCURRENCY(default4; set1for serial comparison or rate-limited backends).dgem.systemone.server_mson gateway adapter spans alongsidedgem.systemone.forward_passesso wall time vs sum-of-passes compute time is directly observable.Test plan
pkg/decisionindex/parallel_passes_test.gocovering multi-batch overlap, serialMaxConcurrency=1mode, wide-option Round-1 parallelism, and error cancellation.go test -race ./cmd/... ./pkg/...andgo -C examples test ./...— all pass.golangci-lint(staticcheck,unused) — 0 findings on edited files.make check-public— passed.