Optimisation of unpackCString#

Don Stewart dons at galois.com
Mon Apr 28 17:20:56 EDT 2008

> Hi
> > Optimisation and ghci don't go together, so I don't know what your point
> >  is there.
> It's very worth having the application work in both Hugs and GHCi, and
> its not always GHC=faster, only if you compile it - so you trade your
> compile time for your run time. A delicate balance, with more than one
> local optima.

But you'd always compile the code if you cared about performance anyway.
20 years of optimisation technology only comes into play then.

> >  Anyway, its the same with ByteString -- we have it work in ghci or hugs
> >  or nhc, but its only worth actually optimising for GHC.
> Can you use overloaded Strings with Hugs? I am not aware of how to. I
> am happy to use RULES's and pragmas etc, but I can't see a way of
> doing overloaded strings this way, as by the time I've got to RULES
> I've gained the unpackCString, which just won't go away!

You'd have to conditionally use overloaded strings in GHC only.
I'm not sure it would work ( can you quantify the cost of not being able
to take head at compile time? )

-- Don

More information about the Glasgow-haskell-users mailing list