long constant list of pairs (was Re: Ways and Build Tags for Optimisation)

Christian Maeder maeder@tzi.de
Mon, 02 Jun 2003 12:46:21 +0200

>    4. Re: Ways and Build Tags for Optimisation (Ashley Yakeley)

> From: Ashley Yakeley <ashley@semantic.org>
> Subject: Re: Ways and Build Tags for Optimisation
> Date: Thu, 29 May 2003 20:40:59 -0700

Sorry for replying from a digest. (Replying from the archive is not 
better, is it?)

> Inside the module is an "Array Char String" created from a 
> "[(Char,String)]" that is a long list of Unicode character names. 

We had very long compilation times when optimization or profiling was 
switched on, for a [(String, Int)] list with about 5000 entries.

We worked around the problem by changing the list into a String 
(escaping doublequotes) and using "read" to convert it to a list.
(Eventually we converted it to a Map.)

>>getCharacterName '\x189F'

We had latin1 characters in our strings.

Cheers Christian

> For some reason, even though only getCharacterName is exported, when 
> optimisation is switched on, the interface file balloons a thousandfold:
> $ ls -l UnicodeNames.*hi
> -rw-r--r--    1 ashley   ashley    5854480 May 28 02:49 UnicodeNames.hi
> -rw-r--r--    1 ashley   ashley    5854497 May 28 06:56 UnicodeNames.p_hi
> -rw-r--r--    1 ashley   ashley       2385 May 28 15:59 UnicodeNames.q_hi
> What's the best way to stop this? Is it reasonable to simply switch off 
> profiling just for these few files?
> Also, I'd like to make all that data disappear when a binary program 
> that doesn't use it is stripped; currently it doesn't. Any ideas?