When using multiple benchmarks earlier ones affect the ones coming later
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- haskell
- 领域
- performance
调研方向
使用组合的和单独的 stack bench --benchmark-arguments 命令,在链接的仓库中复现该差异。从 -m glob ops/map/* 所使用的基准测试选择路径开始,比较 Criterion 的基准测试执行以及进程或运行时隔离行为。完成标准是已确定原因,并且该 issue 有范围明确的修复,或在适用的情况下有包含回归覆盖的已记录限制。
由索引模型根据 Issue 内容生成。
描述
I have the following benchmarks in a group:
bgroup "map"
[ bench "machines" $ whnf drainM (M.mapping (+1))
, bench "streaming" $ whnf drainS (S.map (+1))
, bench "pipes" $ whnf drainP (P.map (+1))
, bench "conduit" $ whnf drainC (C.map (+1))
, bench "list-transformer" $ whnf drainL (lift . return . (+1))
]
The last two benchmarks take significantly more time when I run all these benchmarks in one go using stack bench --benchmark-arguments "-m glob ops/map/*".
$ stack bench --benchmark-arguments "-m glob ops/map/*"
benchmarking ops/map/machines
time 30.23 ms (29.22 ms .. 31.04 ms)
benchmarking ops/map/streaming
time 17.91 ms (17.48 ms .. 18.37 ms)
benchmarking ops/map/pipes
time 29.30 ms (28.12 ms .. 30.03 ms)
benchmarking ops/map/conduit
time 36.69 ms (35.73 ms .. 37.58 ms)
benchmarking ops/map/list-transformer
time 84.06 ms (75.02 ms .. 90.34 ms)
However when I run individual benchmarks the results are different:
$ stack bench --benchmark-arguments "-m glob ops/map/conduit"
benchmarking ops/map/conduit
time 31.64 ms (31.30 ms .. 31.86 ms)
$ stack bench --benchmark-arguments "-m glob ops/map/list-transformer"
benchmarking ops/map/list-transformer
time 68.67 ms (66.84 ms .. 70.96 ms)
To reproduce the issue just run those commands in this repo.
I cannot figure what the problem is here. I tried using "env" to run the benchmarks and putting a "threadDelay" for a few seconds and a "performGC" in it but nothing helps.
I am now resorting to always running each benchmark individually in a separate process. Maybe we can have support for running each benchmark in a separate process in criterion itself to guarantee isolation of benchmarks, as I have seen this sort of problem too often. Now I am always skeptical of the results produced by criterion.
- 主要语言
- Haskell
- 星标
- 525
- 派生
- 88
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
haskell/criterion 的其他 Issue
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 2/5 1-3 小时 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 1/5 1-3 小时 新手友好度 48/100
查看 haskell/criterion 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
haskell/bytestring#730 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
seal-harness/seal-harness#399 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
fmidue/codeworld-tasks#124 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
reflex-frp/reflex#563 ·