
Hi Anand Firstly apologies - my advice from yesterday was trivial advice, changing to a better representation of Strings and avoiding costly operations (++) is valuable and should improve the performance of the program, but it might be a small overall improvement and it doesn't get to the heart of things. Really you need to do two things - one is consider what you are doing and evaluate whether it is appropriate for a performance sensitive app, the other is to profile and find the bits that are too slow. I rarely use Control.Concurrent so I can't offer any real experience but I'm concerned that it is adding overhead for no benefit. Looking at the code and what the comments say it does - I don't think your situation benefits from concurrency. A thread in your program could do all is work in one go, its not that you need to be servicing many clients (cf. a web server that needs to service many clients without individual long waits so it makes sense to schedule them) or that you are waiting on other processes making resources available. So for your program, any changes to execution caused by scheduling / de-scheduling threads (probably) just add to the total time. If you have a multi-core machine you could potentially benefit from parallelism - splitting the work amongst available cores. But in GHC forkIO spawns "green threads" which run in the same OS thread so you won't be getting any automatic parallelism from the code even if you have multi-core. However don't take my word for this - I could easily be wrong. If you want performance you really do need to see what the profiler tells you. Best wishes Stephen