gpt4 book ai didi

haskell - 堆栈运行单一基准测试

转载 作者:行者123 更新时间:2023-12-02 15:47:12 26 4
gpt4 key购买 nike

我在 cabal 文件中定义了多个基准:

benchmark my-gauge-bench
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs:
bench/gauge
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
QuickCheck
, base >=4.10 && <10
, bytestring
, gauge
default-language: Haskell2010

benchmark my-weigh-bench
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules:
Paths_pkg_core_gen
hs-source-dirs:
bench/weigh
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -Wall
build-depends:
QuickCheck
, base >=4.10 && <10
, bytestring
, weigh

如何使用 Stack 只运行单个基准测试(例如 my-guage-bench)?

最佳答案

这适用于堆栈中的所有目标,无论是测试、基准测试还是可执行文件。

堆栈中有一个很酷的小命令,可以帮助您列出所有可用目标,而无需通过 my-package.cabalpackage.yaml 文件进行挖掘。它对于多包项目特别有用,并且适用于 stack.yamlpackages: 字段中列出的所有包:

$ stack ide targets
my-package:lib
my-package:test:doctests
my-package:test:tests
my-package:bench:weight
my-package:bench:gauge
another-package:lib
another-package:exe:my-cool-executable
another-package:test:doctests
another-package:test:tests
another-package:bench:weight
another-package:bench:criterion

现在我们知道了可以调用特定基准的列表

$ stack bench my-package:bench:gauge another-package:bench:criterion

关于haskell - 堆栈运行单一基准测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55508536/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com