[gambit-list] How can built a small as 5 Kbytes "Hello World" program ?

Marc Feeley feeley at iro.umontreal.ca
Tue Jan 20 11:49:26 EST 2015


> On Jan 20, 2015, at 9:55 AM, Hendrik Boom <hendrik at topoi.pooq.com> wrote:
> 
> On Mon, Jan 19, 2015 at 09:45:16PM -0500, Bradley Lucier wrote:
>> On 01/19/2015 05:04 PM, Hendrik Boom wrote:
>>> On Mon, 19 Jan 2015 15:28:19 +0900, Ryuho Yokoyama wrote:
>>> 
>>>> 
>>>> This time the size of the "w.exe" is 136KB.  It's very small.
>>> How can this possibly be considered "small" for such a trivial task, let
>>> along *very* small?
>>> 
>>> That's three times the entire RAM of the first machine I ran a HelloWorld
>>> program on!
>>> 
>>> I really wonder what is filling up all those K!
>> 
>> On Ubuntu 14.10, with all updates:
>> 
>>   firefly:~/programs/gambit/norvig-spell/gambit> cat hello.scm
>>   (display "Hello World!\n")
>>   firefly:~/programs/gambit/norvig-spell/gambit> gsc -exe hello
>>   firefly:~/programs/gambit/norvig-spell/gambit> ll hello
>>   -rwxrwxr-x 1 lucier lucier 10536 Jan 19 21:44 hello*
> 
> That's much smaller than the 136KB mentioned in the post I was replying to.
> 
> " This time the size of the "w.exe" is 136KB.  It's very small.
> 
> Good job.
> 
> Now I really wonder what was going on in the 136KB, or whether 136KB 
> was a typo. 
> 
> -- hendrik

It is probably the ws2_32 library that is statically linked. But frankly on modern machines the difference in space between 5 MB (static link) and 5 KB (shared libs) doesn’t really matter very much.  I almost always favour a static link because it avoids the headache of setting up the shared lib path, version compatibility, etc.  Moreover, it is probably marginally faster to load the executable code from a single file.

Marc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4839 bytes
Desc: not available
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20150120/5adad9b6/attachment.bin>


More information about the Gambit-list mailing list