[MLton-user] A few questions

Matthew Fluet fluet at tti-c.org
Wed Dec 12 07:20:40 PST 2007


On Wed, 12 Dec 2007, David Hansel wrote:
>>> - We have observed that the executable size for our application
>>>  when compiled with MLton is about 3x the size of the heap generated
>>>  by SML/NJ for the same application (60MB vs. 20MB).  Does anybody
>>>  have an idea what could be the reason for this?  Any suggestions as
>>>  to how we can track down where the large size comes from?
>>
>> That is rather large.  The MLton produced executable will include the
>> MLton runtime system, whereas the SML/NJ heap would not include the
>> SML/NJ runtime system.  But, runtime system is only about 30K.
>> BTW, is the MLton produced executable stripped?  The native codegen is
>> pretty free with assembly labels, so they can add up in an unstripped
>> executable.
>
> Thanks, the "strip"ing was the problem.  Sorry,  newbie mistake.  After
> stripping,  the executable size goes down from 60MB to 28MB,  which is
> great.   By the way,  is it possible to instruct MLton not to put the
> labels there in the first place (as opposed to stripping them afterwards)?

MLton produces assembly as text files that are passed to gcc/as.  So, 
there's no way for MLton to use less labels; they are necessary in the 
assembly files.

You might look into options that can be passed to gcc/as (that is, gcc 
used as an assembler) or to gcc/ld (that is, gcc used as a linker).  A lot 
of the assembly labels are local to the file being assembled, so perhaps 
there is a way to instruct the assembler to strip local labels from the 
object file.  Similarly, perhaps there is an option that can be passed to 
the linker to instruct it to strip labels from the final executable.



More information about the MLton-user mailing list