[Haskell-cafe] Library sizes (was: Toy application advice wanted)

Lyle Kopnicky kopnicky at cse.ogi.edu
Wed May 5 12:38:02 EDT 2004


I don't want to pick on any particular library, as this issue can pop up 
with any library in any language.  I feel it's an issue which has been 
addressed before, but the solutions are largely ignored.  This is most 
likely because 1) people assume we have plenty of space or 2) the 
library isn't yet complete, and it's easier to statically link a big 
library for now, and worry about alternatives later.  If I were writing 
a library, I probably wouldn't be too concerned with the issue myself.

It seems there are two ways to address this problem:

1) Shared libraries.  Why not link the library dynamically instead of 
statically?  Is this possible with GHC?  Then multiple applications 
using the library wouldn't balloon the memory use, but share a copy of 
the same library.  For simple development and testing, it's easier to 
statically link, since we only have to worry about one file.  But if we 
expect people to run many programs using this library, we ought to be 
more careful about space usage.  Dynamic linking ought to be an option.

2) Linking in only what's used.  If a simple 'Hello, World!' program 
only needs a window and some buttons, why link in all the code for other 
widgets?  Is there a library format which allows pulling out only those 
operations which are needed?  An alternative is to recompile the library 
code with the program each time, throwing away dead code - that is, the 
library code which is never called.  Recompiling the library code with 
the application takes longer, but need only be done once the program is 
ready for distribution.

If anyone knows of existing solutions in either of these areas, please 
inform us.

- Lyle Kopnicky

Duncan Coutts wrote:

>On Wed, 2004-05-05 at 16:24, Andrei de A. Formiga wrote:
>  
>
>>   I'm finding wxHaskell very nice, and a wxWidgets
>>binding is something many other "advanced" languages
>>don't have (even OCaml). The only downside is having a
>>'Hello World' GUI application with 7 Mb... but it runs
>>quite well and smooth once it's loaded.
>>    
>>
>
>We have the same problem with gtk2hs. A stripped simple(ish) prog weighs
>in at about 2.5Mb.
>
>I'm not quite sure what's in there that makes it so big.
>
>Duncan
>
>_______________________________________________
>Haskell-Cafe mailing list
>Haskell-Cafe at haskell.org
>http://www.haskell.org/mailman/listinfo/haskell-cafe
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org//pipermail/haskell-cafe/attachments/20040505/84bf86b5/attachment.htm


More information about the Haskell-Cafe mailing list