[Haskell-cafe] Space questions about intern and sets

Gracjan Polak gracjan at acchsh.com
Sun Jun 5 05:05:27 EDT 2005


Duncan Coutts wrote:
> On Fri, 2005-06-03 at 10:53 +0200, Gracjan Polak wrote:
> 
>>As intern behaves like id and does not have any side effects, I thought 
>>its interface should be purely functional. But I do not see any way to 
>>do it :( I'll end up with a monad, probably.
> 
> 
>>In related question: does anybody here have experience/benchmarks/tests 
>>how/if is PackedString better (uses less memory) than String in parsing 
>>tasks?
> 
> 
> GHC itself uses a rather low level thing it calls FastString which is
> basically a pointer into a character array with a length and a unique
> id. The unique ids are allocated by entering each FastString into a
> global hash table which also provides sharing if the same string is seen
> more than once (like your itern feature).

I thought FastString was first incarnation of PackedString, thanks for 
the hint it could be something more.

Does HaXml use any such optimization for XML element name handling?

> 
> It is all very low level and ghc-specific however and probably only
> makes sence in a compiler-like application.

Exactly my setting.

> 
> Duncan

-- 
Gracjan


More information about the Haskell-Cafe mailing list