
On Sat, Sep 1, 2012 at 6:33 AM, Krzysztof Skrzętnicki
makeSessionBackend calls "getKey" from clientsession:
http://hackage.haskell.org/packages/archive/clientsession/0.8.0/doc/html/src...
Looking at that function no wonder it is a bottleneck:
-- | Get a key from the given text file. -- -- If the file does not exist or is corrupted a random key will -- be generated and stored in that file. getKey :: FilePath -- ^ File name where key is stored. -> IO Key -- ^ The actual key. getKey keyFile = do exists <- doesFileExist keyFile if exists then S.readFile keyFile >>= either (const newKey) return . initKey else newKey where newKey = do (bs, key') <- randomKey S.writeFile keyFile bs return key'
Plenty of syscalls, reading and parsing the same file over and over again. Perhaps the default should be to store the key within the foundation datatype at startup?
Unfortunately it's not so simple: makeSessionBackend is called just once by 'toWaiAppPlain', which is in turn called just once when your application starts. Cheers, =) -- Felipe.