transient
transient copied to clipboard
Use raw fork instead of forkIO
Since we create threads quite often it may be helpful to use raw fork instead of forkIO. Something like this:
-- A version of forkIO that does not include the outer exception
-- handler: saves a bit of time when we will be installing our own
-- exception handler.
{-# INLINE rawForkIO #-}
rawForkIO :: IO () -> IO ThreadId
rawForkIO action = IO $ \ s ->
case (fork# action s) of (# s1, tid #) -> (# s1, ThreadId tid #)
If this is faster, It would be worth the pain