v0.12.0 regression: evaluation time exponential in derived features referenced from untaken if branches
维护者通常 1 天内回复
@devin-ai-integration 已经在做这个了。
开始于 2026年11月5日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- go
- 领域
- performance
调研方向
Start by reviewing the v0.12.0 changelog entries about order-dependence marks and cycle detection, then trace evaluation of if operands declared as in expr in ControlFunctions. Reproduce with the supplied gen.py model and compare the expression-valued and plain-default feature timings. Done means untaken branches avoid exponential evaluation while preserving the reported results; linked pull request #1933 is already open.
由索引模型根据 Issue 内容生成。
描述
Summary
In v0.12.0, evaluating a feature valued by an expression takes time exponential in the number of other expression-valued features referenced from untaken if branches. v0.11.0 evaluates the same model in constant time. The results are the same in both versions; only the time differs. No diagnostic is emitted, so a larger model just appears to hang.
Reproduction
gen.py writes N features a1..aN. Each ai picks another feature by an integer selector pi (default 0, so every branch is untaken):
import sys
n, target = int(sys.argv[1]), sys.argv[2] # target: "a" (expression-valued features) or "c" (plain defaults)
print(f"package R {{ private import ScalarValues::*; part def T {{")
for i in range(1, n + 1):
e = "false"
for j in range(n, 0, -1):
e = f"(if p{i} == {j} ? {target}{j} else {e})"
print(f" attribute p{i} : Integer default 0; attribute c{i} : Boolean default true;")
print(f" attribute a{i} : Boolean = {e};")
print("} part t : T; }")
python3 gen.py 9 a > r.sysml
sysml r.sysml -e '$::R::t.a1'
Timings (linux-amd64 release binaries, same machine)
| N | branches reference a_j — v0.11.0 |
branches reference a_j — v0.12.0 |
branches reference c_j — v0.12.0 |
|---|---|---|---|
| 7 | ~0.05 s | 0.17 s | 0.05 s |
| 8 | 0.05 s | 0.31 s | 0.05 s |
| 9 | 0.06 s | 2.71 s | 0.05 s |
| 10 | 0.07 s | 29.94 s | 0.05 s |
All runs print = false. Loading and validating r.sysml alone takes about 0.02 s, so the time is spent in evaluation.
Control experiments (N = 9, v0.12.0)
- Only
if, all branches untaken (the generator above): 2.8 s. This rules outor/andas the cause. - The same chain prefixed with
p1 == 0 or …, or withp1 != 0 and …: about 3 s each. - The same shape, but the branches reference plain
defaultfeaturesc_j, so there are no references between expression-valued features: 0.05 s. - A direct self-reference only (
a = true or a): 0.06 s.
So the slowdown needs untaken branches that reference other expression-valued features which, syntactically, form cycles. The cycles are never taken at run time.
Expected
ControlFunctions declares the branch operands of if, and, or and implies as in expr. Its doc describes these operands as "expressions whose evaluation is determined by another operand". An untaken branch should therefore not need to be evaluated. In any case, the cost should not grow exponentially with the size of the model, as it did not in v0.11.0.
Notes
The 0.12.0 changelog has two entries that may be related, though we have not confirmed either:
- expression-valued features now carry order-dependence marks "through features so valued in turn";
- "a cycle among such features is refused by the interpreter at the start".
We found this in a model with about 9 mutually referencing derived features. One evaluation went from 0.45 s in v0.11.0 to more than 90 s in v0.12.0, after which we stopped it. We have since rewritten that model with ref features, which v0.12.0 evaluates fast, so this is not blocking us. We are reporting it as a regression.
- 主要语言
- Go
- 星标
- 56
- 派生
- 17
- 平均合并
- 12 小时 21 分钟
- 30 天内合并 PR
- 900
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Open-MBEE/OpenSysML 的其他 Issue
-
dependencies
难度 2/5 1-3 小时 新手友好度 65/100
Open-MBEE/OpenSysML#1951 · 3 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
question
难度 2/5 1-3 小时 新手友好度 66/100
Open-MBEE/OpenSysML#1359 · 4 条评论 ·
维护者通常 1 天内回复
-
bug enhancement spec compliance
难度 4/5 3-5 天 新手友好度 42/100
Open-MBEE/OpenSysML#1965 · 1 条评论 ·
维护者通常 1 天内回复
-
Prefix metadata (`#FailureMode state s;`) is missing from both the Symbol API and the query API, although api-json exports it as an owned MetadataUsage可能已有人在做 @devin-ai-integration 于 1 天前认领。 未关闭bug spec compliance
难度 4/5 3-5 天 新手友好度 35/100
Open-MBEE/OpenSysML#1963 · 2 条评论 ·
维护者通常 1 天内回复
-
A port typed `~P` reports its type as `P`: the conjugation is lost in the Symbol, query and reflection APIs and in api-json's PortUsage.type可能已有人在做 @devin-ai-integration 今天认领。 未关闭bug spec compliance
难度 4/5 3-5 天 新手友好度 20/100
Open-MBEE/OpenSysML#1962 · 2 条评论 ·
维护者通常 1 天内回复
查看 Open-MBEE/OpenSysML 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
openmcp-project/service-provider-crossplane#330 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
openmcp-project/service-provider-kro#220 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
[FEATURE]: Set fieldPath and reason on the CEL validation rules可能已有人在做 @bjosv 今天认领。 未关闭enhancement needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
valkey-io/valkey-operator#618 ·
维护者通常 3 天内回复