Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
154 views
in Technique[技术] by (71.8m points)

Benchmarking in Haskell

I have to add some benchmarks using criterion package. I added to package.yaml file these lines:

benchmarks:
  hw4-bench:
    main:                Main.hs
    source-dirs:         bench
    ghc-options:
      - -eventlog
      - -threaded
      - -rtsopts
      - -with-rtsopts=-N6
      - -O2
    dependencies:
      - hw4

Also I created bench/Main.hs. But when I use stack bench command I get a message with an error:

Running 1 benchmarks...
Benchmark hw4-bench: RUNNING...
benchmarking perimeter/strict perimeter of 100 points
time      Completed 2 action(s).
terminateProcess: permission denied (Permission denied)

Code that I test is pure. Why do I have permission denied error? Also if I run by myself bench.exe file in .stack-work I don't have any problems. What am I doing wrong?

UPD: After updating stack to version 2.5.1, error <stderr>: commitAndReleaseBuffer: invalid argument (invalid character) comes, but chcp 65001 solves it too.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Looks like people run into this process error when used on non-utf-8 consoles (source)

Can you try running chcp 65001 and then stack bench? We can at least rule this out as a factor.

edit if chcp 65001 works, you can set the console to utf-8 permanently, as detailed here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...