Haskell 堆栈运行单个基准测试
我的阴谋集团文件中定义了多个基准:Haskell 堆栈运行单个基准测试,haskell,benchmarking,haskell-stack,Haskell,Benchmarking,Haskell Stack,我的阴谋集团文件中定义了多个基准: 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 -
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
对我的仪表台进行基准测试
类型:exitcode-stdio-1.0
main是:main.hs
hs源目录:
工作台/仪表
ghc选项:-Wall-Wcompat-Wincomplete记录更新-Wincomplete uni模式-Wredundant约束-Wall-threaded-rtsopts-带rtsopts=-N
构建取决于:
快速检查
,base>=4.10&&=4.10&&您需要执行类似操作才能运行单个基准测试:
stack bench package-name:my-guage-bench
这适用于堆栈中的所有目标,无论是测试、基准测试还是可执行文件
堆栈中有一个很酷的小命令,可以帮助您列出所有可用的目标,而无需通过挖掘my package.cabal
或package.yaml
文件。它特别适用于多包项目,并适用于stack.yaml中packages:
字段中列出的所有包:
$ 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
好奇的是,base>=4.10&&@SimonShine我想这是为了在上传包到Hackage之前避免来自cabal
的警告。