Runtime performance degradation for multi-threaded C FFI callback

John Lato jwlato at
Mon Jan 23 15:54:01 CET 2012

I agree the OS scheduler is likely to contribute to our different
observations.  I'll try to test with ghc-7.4-rc1 tonight to see if I
get similar results to 7.2.1.

If you want to see some code I'll post it, although I doubt it's
necessary.  I would appreciate it if you (or someone else in the know)
could answer a question for me: does the GHC runtime handle scheduling
of code from Haskell threads (forkIO) and foreign callbacks (via
FunPtr's) in the same way, or are there restrictions on which
capability may handle one or the other (ignoring bound threads and the

Thank you,
John L.

On Mon, Jan 23, 2012 at 1:26 PM, Simon Marlow <marlowsd at> wrote:
> I'll need to analyse the program to see what's going on.  There was a small
> change to the scheduler between 7.2.1 and 7.2.2 that could conceivably have
> made a difference in this scenario, but it was aimed at fixing a bug rather
> than improvement performance.
> Another possibility is a difference in OS scheduling behaviour between yours
> and Daniel Fischer's setup.  In microbenchmarks like this, it's easy for a
> difference in OS scheduling behaviour to make a large difference in
> performance if it happens consistently.
> Cheers,
>        Simon

More information about the Glasgow-haskell-users mailing list