From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: <20130323100519.GA3980@polynum.com> <19750d1b50c54941f031f57dc4be456e@proxima.alt.za> <5099C9E8-C6E8-4B6B-A609-B5BDCA6C332F@lsub.org> <5C91EC08-2559-4DA8-B6F3-9293747EEFE8@gmail.com> <20130323173739.GA3314@polynum.com> Date: Sun, 24 Mar 2013 10:58:52 +1100 Message-ID: From: Bruce Ellis To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=f46d0443045692b3ed04d8a05a4b Subject: Re: [9fans] gcc not an option for Plan9 Topicbox-Message-UUID: 32282e6e-ead8-11e9-9d60-3106f5b1d025 --f46d0443045692b3ed04d8a05a4b Content-Type: text/plain; charset=UTF-8 I recall one guy at the labs(!) who would ruthlessly avoid printf because it dragged in too much stuff. I think he ran out of people to argue with 30 years ago. On 24 Mar 2013 10:47, "andrey mirtchovski" wrote: > > If you want real programs which are bigger that I (we) actually use that > will > > be (much) bigger in go: > > > > ls, cp rm mv cat acid, I can go on. > > > > Small programs are useful and important. > > here's a representative set. the programs are identical in behaviour > and arguments to the Plan 9 set. the size is as reported by du, in > kilobytes: > > 1456 ./date/date > 1460 ./cat/cat > 1564 ./cleanname/cleanname > 1564 ./tee/tee > 1736 ./echo/echo > 1764 ./cp/cp > 1772 ./uniq/uniq > 1780 ./cmp/cmp > 1780 ./freq/freq > 1780 ./wc/wc > 1792 ./comm/comm > > > binaries are bigger and for example replacing the minimal sets of > commands of > > the system, this can make the > > minimal system at least 5 times bigger easy. > > if that was a real issue you were trying to solve there are things you > can do to help yourself. most notably sticking everything in a single > binary and invoking the right function based on your argv0. it took me > less than 15 minutes to convert the above code to work as a single > binary and most of that was in handling clashing flags (it would've > been a non-issue if I had used flagsets when writing the original > programs). size at the very end: > > $ date > test.txt > $ ln -s $GOPATH/bin/all cat > $ ln -s $GOPATH/bin/all wc > $ ./cat test.txt > Sat Mar 23 17:32:42 MDT 2013 > $ ./wc test.txt > 1 6 29 test.txt > $ du -k $GOPATH/bin/all > 1888 /Users/andrey/bin/all > > the size of the original binaries on plan9 is 588k. what was a factor > of 30 is now a factor of 3. all tests still pass and it took less time > to complete than writing this email. > > there's an even better solution, but it won't work on plan9 because > the go tool is slow there :) > > --f46d0443045692b3ed04d8a05a4b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

I recall one guy at the labs(!) who would ruthlessly avoid p= rintf because it dragged in too much stuff. I think he ran out of people to= argue with 30 years ago.

On 24 Mar 2013 10:47, "andrey mirtchovski&q= uot; <mirtchovski@gmail.com= > wrote:
> If you want real programs which are bigger that I (we) actually use th= at will
> be (much) bigger in go:
>
> ls, cp rm mv cat acid, I can go on.
>
> Small programs are useful and important.

here's a representative set. the programs are identical in behaviour and arguments to the Plan 9 set. the size is as reported by du, in
kilobytes:

1456 ./date/date
1460 ./cat/cat
1564 ./cleanname/cleanname
1564 ./tee/tee
1736 ./echo/echo
1764 ./cp/cp
1772 ./uniq/uniq
1780 ./cmp/cmp
1780 ./freq/freq
1780 ./wc/wc
1792 ./comm/comm

> binaries are bigger and for example replacing the minimal sets of comm= ands of
> the system, this can make the
> minimal system at least 5 times bigger easy.

if that was a real issue you were trying to solve there are things you
can do to help yourself. most notably sticking everything in a single
binary and invoking the right function based on your argv0. it took me
less than 15 minutes to convert the above code to work as a single
binary and most of that was in handling clashing flags (it would've
been a non-issue if I had used flagsets when writing the original
programs). size at the very end:

$ date > test.txt
$ ln -s $GOPATH/bin/all cat
$ ln -s $GOPATH/bin/all wc
$ ./cat test.txt
Sat Mar 23 17:32:42 MDT 2013
$ ./wc test.txt
=C2=A0 =C2=A0 =C2=A0 1 =C2=A0 =C2=A0 =C2=A0 6 =C2=A0 =C2=A0 =C2=A029 test.t= xt
$ du -k $GOPATH/bin/all
1888 /Users/andrey/bin/all

the size of the original binaries on plan9 is 588k. what was a factor
of 30 is now a factor of 3. all tests still pass and it took less time
to complete than writing this email.

there's an even better solution, but it won't work on plan9 because=
the go tool is slow there :)

--f46d0443045692b3ed04d8a05a4b--