ghci timings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ghci timings

Mike Houghton
Hi,
I have a function that takes a while to execute and its output is a list of 1000 numbers. I’ve setup ghci to show timings.
So in ghci I run the function, it churns away and then starts display the output list and finally shows the timings.
I’m assuming that the execution time includes the time taken to output the result. Is it possible to get the execution time that does not include the time to output the result?

Thanks

Mike





_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: ghci timings

Mike Houghton
Sorry - I’m being stupid,

Just use last to print the last in the list. List is still evaluated but no real print overhead.
duh.

Mike

> On 25 May 2018, at 12:26, mike h <[hidden email]> wrote:
>
> Hi,
> I have a function that takes a while to execute and its output is a list of 1000 numbers. I’ve setup ghci to show timings.
> So in ghci I run the function, it churns away and then starts display the output list and finally shows the timings.
> I’m assuming that the execution time includes the time taken to output the result. Is it possible to get the execution time that does not include the time to output the result?
>
> Thanks
>
> Mike
>
>
>
>
>

_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: ghci timings

Doug McIlroy
In reply to this post by Mike Houghton
 > Just use last to print the last in the list.

Because of lazy evaluation, this doesn't guarantee that the
earlier elements have been computed. You might use "sum" to
assure that they are.

Doug
_______________________________________________
Beginners mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners