使用Benchmark.js进行Elm性能测试

Elm中使用Benchmark.js,您需要首先安装一些依赖项:

$cabal install
$npm install benchmark
$npm install jsdom

注意:在Windows上安装jsdom可能会遇到一些困难,可以参考相关文档进行解决。

测试示例:每个测试必须是() -> ()类型的传出port。在Benchmark模块中定义任意数量的测试。以下是一个基本示例:

module Benchmark where

discard : a -> ()
discard _ = ()

port testAdd10 : () -> ()
port testAdd10 =

该方法可以用来测试不同代码块的执行效率,适用于基于Elm的性能基准测试。

zip
Elm-Benchmark-master.zip 预估大小:9个文件
folder
Elm-Benchmark-master 文件夹
file
prescript.js 126B
file
Test.elm 883B
file
ElmBenchmark.cabal 934B
file
mkExe.hs 2KB
file
LICENSE 1KB
file
Setup.hs 46B
file
.gitignore 63B
file
postscript.js 558B
file
README.md 2KB
zip 文件大小:5.25KB