have criterion analyse user supplied timing data?

未关闭
#110 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
haskell
领域
performance

调研方向

从 Criterion.Internal 开始,尤其是 analyseOne 和 analyseSample,并使用列出的 Measured 值和固定开销复现所提供的示例。跟踪 timing 和开销在分析及报告路径中是如何解释的;完成的标准是确定是否可以支持用户提供的数据,并在可以支持时生成有效的非负 timing 输出。

由索引模型根据 Issue 内容生成。

描述

Enhancement Question

Is it possible to use the criterion analysis and reporting functions on timing data that I supply?

I've tried hacking the criterion code to get this simple example to work:

{-# LANGUAGE RecordWildCards #-}

import Criterion.Monad (withConfig)
import Criterion.Main (defaultConfig)
import Control.Monad.Except
import Criterion.Internal
import Criterion.Types
import qualified Data.Vector as V

theData = [ 2.0, 2.1, 2.2, 2.1, 2.1, 2.15, 2.09 ] :: [Double]

mkMeas t = Measured t t cycles 1 0 0 0 0 0 0 0 
  where cycles = floor (1000000*t)

main = do
  let ms = map mkMeas theData
  withConfig defaultConfig $ do
    r <- analyseOne 1 "foo" (V.fromList ms)
    liftIO $ putStrLn "done"

The changes I made to the criterion source to get this to "work" were:

  • export analyseOne from Criterion.Internal
  • in analyseSample set overhead to a constant (0.00001)

However, this reports a negative value for "time":

time                 -9.4833e15 s (-9.6763e15 s .. -9.2838e15 s)
                     -3.497 R²  (-9782.939 R² .. -1.158 R²)
mean                 2.123 s    (2.097 s .. 2.175 s)
std dev              43.20 ms   (21.60 ms .. 58.54 ms)
variance introduced by outliers: 12% (moderately inflated)

Am I on the right track, or am I missing something? Thanks!

主要语言
Haskell
星标
525
派生
88
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

haskell/criterion 的其他 Issue

查看 haskell/criterion 的全部 Issue

相似的 Issue

更多 Haskell Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。