I have a relatively slow procedure (aptly named slow), and I would like to do something like
time $ slow [1,2,3,4,5]
in the console (REPL) to get the time, instead of having to compile the program and then run time.
Can this be done?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you enter
:set +sin GHCi, then timing and memory info will be printed after the evaluation of every expression.Example:
Note that this will be the timing of the expression as evaluated in the interpreter, without optimisation, so it won’t necessarily be an accurate measure of how long things take, or even which of two versions of the same code will be faster, in actual compiled code. For that, take a look at the criterion benchmarking library.