[Haskell-cafe] Optimising UTF8-CString -> String marshaling, plus comments on withCStringLen/peekCStringLen

Alistair Bayley alistair at abayley.org
Fri Jun 15 09:28:09 EDT 2007


Sorry for the delay on responding.

> I'm using 6.6, so I'll upgrade to 6.6.1 and retest. Preusmably you're
> only interested if this behaviour persists in 6.6.1. I'll check both
> cases and make a test cases for them if necessary.

I've upgraded to 6.6.1 and am pleased to report that there appears to
be no difference between seq and bang-patterns in the simplifier output.

As for the other case (where a function results in two functions in the
simplifier output, which appear to be some sort of worker-wrapper pair),
a module is attached which gives this behaviour.

I compiled it with:
  ghc -c UTF8.hs -O2 -prof -auto -ddump-simpl

Look for $s$wfromUTF8Ptr and $wfromUTF8Ptr.

I also notice that with -auto-all, the function readUTF8Char appears in
the simplifier output, but with -auto it is inlined into fromUTF8Ptr, and
so vanishes from the simplifier output.

Running my test case compiled with -auto seems to gives run times at about
70-80% of -auto-all, and allocation is 40% (!) of -auto-all; that's a
significant difference.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: UTF8.hs
Type: text/x-haskell
Size: 2568 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070615/8fe8f030/UTF8-0001.bin

More information about the Haskell-Cafe mailing list