RE: openFile and threads

Hi Simon,
If the openFile isn't on the critical path, then it can help to do it in another thread, but only if the openFile is blocking (not usually the case if you're opening a normal file).
Actually, we tried that using mergeIO, but there was no real improvement.
You might consider bypassing the Handle interface and going to the bare metal using the Posix library, which will cut down on the overhead in openFile.
That's what I was fearing. Is the conversion from Haskell Strings to C strings a performance problem?
The best solution is to avoid the open altogether if possible (eg. with caching), but I don't know about your particular application so this might not be a possibility.
No, that's not possible. The program reads every file at most once and then terminates. Although one might contemplate writing a separate server that keeps all the information in memory and refreshes it regularly. Thanks -Peter
participants (1)
-
Peter Thiemann