f99010fae1
CI / lint (push) Failing after 1s
CI / frontend (push) Failing after 1s
CI / scripts (push) Failing after 1s
CI / Go Test (ubuntu-latest) (push) Failing after 0s
CI / frontend-node-25 (push) Failing after 1s
CI / docs (push) Failing after 0s
CI / coverage (push) Failing after 0s
CI / e2e (push) Failing after 0s
Docker / build-and-push (push) Failing after 1s
CI / integration (push) Failing after 4m43s
CI / Go Test (windows-latest) (push) Has been cancelled
CI / Desktop Unit Tests (Windows) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux (arm64)) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Linux) (push) Has been cancelled
Desktop Artifacts / Desktop Build (Windows) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (aarch64)) (push) Has been cancelled
Desktop Artifacts (macOS) / Desktop Build (macOS (x86_64)) (push) Has been cancelled
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package parser
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func BenchmarkParseCodexSession(b *testing.B) {
|
|
fixtureDir := filepath.Join("testdata", "codex")
|
|
toolCalls, err := os.ReadFile(filepath.Join(fixtureDir, "function_calls.jsonl"))
|
|
require.NoError(b, err)
|
|
largePath := filepath.Join(b.TempDir(), "large_session.jsonl")
|
|
err = os.WriteFile(
|
|
largePath, []byte(strings.Repeat(string(toolCalls), 100)), 0o600,
|
|
)
|
|
require.NoError(b, err)
|
|
|
|
factory, ok := ProviderFactoryByType(AgentCodex)
|
|
require.True(b, ok)
|
|
provider, ok := factory.NewProvider(ProviderConfig{}).(*codexProvider)
|
|
require.True(b, ok)
|
|
|
|
for _, fixture := range []struct {
|
|
name string
|
|
path string
|
|
}{
|
|
{"standard", filepath.Join(fixtureDir, "standard_session.jsonl")},
|
|
{"tool_calls", filepath.Join(fixtureDir, "function_calls.jsonl")},
|
|
{"large_tool_calls", largePath},
|
|
} {
|
|
b.Run(fixture.name, func(b *testing.B) {
|
|
b.ReportAllocs()
|
|
for b.Loop() {
|
|
_, _, err := provider.parseSession(
|
|
fixture.path, "benchmark", false,
|
|
)
|
|
require.NoError(b, err)
|
|
}
|
|
})
|
|
}
|
|
}
|