Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

edit: the big-TOML ratio test compares 1 MB with 8 MB under a bound of 24 (#2219)

yetone99299c7b1c59
diff --git a/internal/edit/toml_shape_test.go b/internal/edit/toml_shape_test.go
index 4db63ee84..6189c2f16 100644
--- a/internal/edit/toml_shape_test.go
+++ b/internal/edit/toml_shape_test.go
@@ -54,13 +54,13 @@ func tomlBigFile(size int) []string {
return splitLines("model_provider = \"x\"\n" + b.String())
}
-// parseTOMLTimed parses lines three times and keeps the fastest, which a
+// parseTOMLTimed parses lines five times and keeps the fastest, which a
// loaded runner can still reach, and the file it read.
func parseTOMLTimed(t *testing.T, lines []string) (tomlFile, time.Duration) {
t.Helper()
var f tomlFile
var best time.Duration
- for rep := 0; rep < 3; rep++ {
+ for rep := 0; rep < 5; rep++ {
start := time.Now()
got, err := parseTOMLFile(lines)
if err != nil {
@@ -78,16 +78,17 @@ func parseTOMLTimed(t *testing.T, lines []string) (tomlFile, time.Duration) {
// square: Codex's own reached 1.5 MB, and each key's line was counted from
// the top of the file, a third of a second at every magpie start.
//
-// The check is the ratio between parsing a 2 MB and an 8 MB file, not a bound
+// The check is the ratio between parsing a 1 MB and an 8 MB file, not a bound
// in seconds: a runner at load ~190 took the still-linear 3 MB parse past the
// old 1s bound and went red without anything quadratic (#2219). Load slows
-// both parses together, not their ratio. A parse that grows with size squared
-// needs 16× the time for the 4× bigger file, where the linear one needs 4×,
-// so the bound sits between the two, far from both.
+// both parses, if not always alike. A parse that grows with size squared
+// needs 64× the time for the 8× bigger file, where the linear one needs 8×,
+// so the bound of 24 leaves about 3× on both sides: at 2 MB and 8 MB with a
+// bound of 8 (2× each side), mote at load 250 went red 1 run in 13.
func TestTOMLBigFileParsesInLinearTime(t *testing.T) {
- small, large := tomlBigFile(2<<20), tomlBigFile(8<<20)
+ small, large := tomlBigFile(1<<20), tomlBigFile(8<<20)
f, dSmall := parseTOMLTimed(t, small)
- if len(f.tables) < 30000 || f.root.keys[0].name != "model_provider" {
+ if len(f.tables) < 10000 || f.root.keys[0].name != "model_provider" {
t.Fatalf("parsed %d tables, root %+v", len(f.tables), f.root.keys)
}
last := f.tables[len(f.tables)-1]
@@ -95,7 +96,7 @@ func TestTOMLBigFileParsesInLinearTime(t *testing.T) {
t.Errorf("last key %+v of %d lines", k, len(small))
}
_, dLarge := parseTOMLTimed(t, large)
- if ratio := float64(dLarge) / float64(dSmall); ratio > 8 {
- t.Errorf("an 8 MB file took %v to parse, %.1f× the 2 MB one's %v: near the 16× of size squared, not the 4× of size", dLarge, ratio, dSmall)
+ if ratio := float64(dLarge) / float64(dSmall); ratio > 24 {
+ t.Errorf("an 8 MB file took %v to parse, %.1f× the 1 MB one's %v: near the 64× of size squared, not the 8× of size", dLarge, ratio, dSmall)
}
}