Tutorial :run a same haskell application take diff time


I wrote an application to analyze a log file using haskell. When I run it with the same log file, sometimes it costs 30s, and sometimes costs 20s, the execution time differs by up to 10 seconds.

why is there such a large difference in running time?


Try separating the processing time from the file-access time.

Read the entire file into memory, track that time, then process the data in your storage strucutres and track that time separately.

My gut instinct is that the file access is the random contriubtor. Gut instinct is not a good substitution for a profiler.


The difference is more than likely caused by other processes that are running at the same time on the system.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »