this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: remove redundant updateConjunctInfo call

The call to updateConjunctInfo(TopKind, id, 0) at the start of
insertValueConjunct was redundant. It created conjunctInfo entries
prematurely with TopKind (all bits set) and no flags, which provides
no useful information for typo checking.

Every code path that needs tracking eventually calls updateConjunctInfo
with actual type information:

- *Vertex with StructMarker: calls updateNodeType(StructKind, ...)
- *Vertex non-data: scheduleVertexConjuncts processes conjuncts individually
- *Vertex with ListMarker: task calls updateListType -> updateNodeType
- *Bottom: error case, no tracking needed
- *Builtin: falls through to updateNodeType or recurses
- All other values: go through updateNodeType(v.Kind(), ...)
- *Top: explicitly calls updateConjunctInfo with cHasTop flag

The early call was either immediately superseded by a more specific call,
or created entries for paths where task scheduling handles tracking later.

Much of this analysis was done by Claude Opus,
to double check that this is correct beyond the lack of test failures.

│ old │ new │
│ B/op │ B/op vs base │
VetInventory 4.593Gi ± ∞ ¹ 4.592Gi ± ∞ ¹ -0.03% (p=1.000 n=1)

│ old │ new │
│ allocs/op │ allocs/op vs base │
VetInventory 47.92M ± ∞ ¹ 47.89M ± ∞ ¹ -0.06% (p=1.000 n=1)

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I7b988fc71c3b3db24379123320b6883e39de8223
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1229641
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Matthew Sackman <matthew@cue.works>

+14 -16
+2 -2
cue/testdata/benchmarks/issue2176.txtar
··· 70 70 71 71 NumCloseIDs: 648 72 72 73 - ConjunctInfos: 1022 73 + ConjunctInfos: 950 74 74 MaxConjunctInfos: 28 75 75 MaxReqSets: 26 76 76 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- ··· 103 103 + 104 104 +NumCloseIDs: 648 105 105 + 106 - +ConjunctInfos: 1022 106 + +ConjunctInfos: 950 107 107 +MaxConjunctInfos: 28 108 108 +MaxReqSets: 26 109 109 -- out/eval/stats --
+4 -4
cue/testdata/builtins/closed.txtar
··· 104 104 105 105 NumCloseIDs: 88 106 106 107 - ConjunctInfos: 262 108 - MaxConjunctInfos: 6 107 + ConjunctInfos: 239 108 + MaxConjunctInfos: 5 109 109 MaxReqSets: 6 110 110 MaxRedirect: 2 111 111 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- ··· 134 134 + 135 135 +NumCloseIDs: 88 136 136 + 137 - +ConjunctInfos: 262 138 - +MaxConjunctInfos: 6 137 + +ConjunctInfos: 239 138 + +MaxConjunctInfos: 5 139 139 +MaxReqSets: 6 140 140 +MaxRedirect: 2 141 141 -- out/eval/stats --
+2 -2
cue/testdata/cycle/comprehension.txtar
··· 430 430 431 431 NumCloseIDs: 728 432 432 433 - ConjunctInfos: 1165 433 + ConjunctInfos: 1120 434 434 MaxConjunctInfos: 10 435 435 MaxReqSets: 12 436 436 MaxRedirect: 1 ··· 1292 1292 + 1293 1293 +NumCloseIDs: 728 1294 1294 + 1295 - +ConjunctInfos: 1165 1295 + +ConjunctInfos: 1120 1296 1296 +MaxConjunctInfos: 10 1297 1297 +MaxReqSets: 12 1298 1298 +MaxRedirect: 1
+2 -2
cue/testdata/cycle/issue4228.txtar
··· 107 107 108 108 NumCloseIDs: 77 109 109 110 - ConjunctInfos: 197 110 + ConjunctInfos: 196 111 111 MaxConjunctInfos: 8 112 112 MaxReqSets: 9 113 113 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- ··· 136 136 + 137 137 +NumCloseIDs: 77 138 138 + 139 - +ConjunctInfos: 197 139 + +ConjunctInfos: 196 140 140 +MaxConjunctInfos: 8 141 141 +MaxReqSets: 9 142 142 -- out/eval/stats --
+2 -2
cue/testdata/definitions/typocheck.txtar
··· 641 641 642 642 NumCloseIDs: 440 643 643 644 - ConjunctInfos: 1132 644 + ConjunctInfos: 1115 645 645 MaxConjunctInfos: 5 646 646 MaxReqSets: 9 647 647 MaxRedirect: 2 ··· 674 674 + 675 675 +NumCloseIDs: 440 676 676 + 677 - +ConjunctInfos: 1132 677 + +ConjunctInfos: 1115 678 678 +MaxConjunctInfos: 5 679 679 +MaxReqSets: 9 680 680 +MaxRedirect: 2
+2 -2
cue/testdata/eval/issue3672.txtar
··· 312 312 313 313 NumCloseIDs: 819 314 314 315 - ConjunctInfos: 894 315 + ConjunctInfos: 885 316 316 MaxConjunctInfos: 7 317 317 MaxReqSets: 15 318 318 MaxRedirect: 6 ··· 342 342 + 343 343 +NumCloseIDs: 819 344 344 + 345 - +ConjunctInfos: 894 345 + +ConjunctInfos: 885 346 346 +MaxConjunctInfos: 7 347 347 +MaxReqSets: 15 348 348 +MaxRedirect: 6
-2
internal/core/adt/conjunct.go
··· 476 476 func (n *nodeContext) insertValueConjunct(env *Environment, v Value, id CloseInfo) { 477 477 ctx := n.ctx 478 478 479 - n.updateConjunctInfo(TopKind, id, 0) 480 - 481 479 switch x := v.(type) { 482 480 case *Vertex: 483 481 if x.ClosedNonRecursive {