here's a comparison of 5g and 5l build times of godoc on the Raspberry Pi
(512MB version); .
[email protected] ~/go/src/cmd/godoc $ go version
go version devel +afac768ad2fe Wed Dec 12 21:38:52 2012 +1100 linux/arm
[email protected] ~/go/src/cmd/godoc $ /usr/bin/time -v
/home/pi/go/pkg/tool/linux_arm/5g -o $WORK/cmd/godoc/_obj/_go_.5 -p
cmd/godoc -D _/home/pi/go/src/cmd/godoc -I $WORK ./codewalk.go
./dirtrees.go ./filesystem.go ./format.go ./godoc.go ./index.go ./main.go
./parser.go ./play-local.go ./play.go ./snippet.go ./spec.go ./template.go
./throttle.go ./utils.go ./zip.go
Command being timed: "/home/pi/go/pkg/tool/linux_arm/5g -o
/tmp/go-build279461654/cmd/godoc/_obj/_go_.5 -p cmd/godoc -D
_/home/pi/go/src/cmd/godoc -I /tmp/go-build279461654 ./codewalk.go
./dirtrees.go ./filesystem.go ./format.go ./godoc.go ./index.go ./main.go
./parser.go ./play-local.go ./play.go ./snippet.go ./spec.go ./template.go
./throttle.go ./utils.go ./zip.go"
User time (seconds): 4.02
System time (seconds): 0.27
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.30
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 51984
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 13058
Voluntary context switches: 1
Involuntary context switches: 96
Swaps: 0
File system inputs: 0
File system outputs: 3096
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
...
[email protected] ~/go/src/cmd/godoc $ /usr/bin/time -v
/home/pi/go/pkg/tool/linux_arm/5l -o $WORK/cmd/godoc/_obj/a.out -L $WORK
$WORK/cmd/godoc.a
Command being timed: "/home/pi/go/pkg/tool/linux_arm/5l -o
/tmp/go-build279461654/cmd/godoc/_obj/a.out -L /tmp/go-build279461654
/tmp/go-build279461654/cmd/godoc.a"
User time (seconds): 9.49
System time (seconds): 0.81
Percent of CPU this job got: 99%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:10.33
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 113816
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 28643
Voluntary context switches: 1
Involuntary context switches: 243
Swaps: 0
File system inputs: 0
File system outputs: 13976
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
On Friday, December 7, 2012 4:39:19 AM UTC-5, Dave Cheney wrote:Hello,
Memory usage by the gc compiler series is always a problem for small
memory arm devices. For example compiling the go files in the net
package with 5g takes approximately 108mb of ram. Last night I
annotated gc/subr.c:mal to try to figure out where all the memory was
going. Here are some of the details. The struct types, if known are
listed to the right.
[email protected]:~/go/src/pkg/net$ sort /tmp/mal.txt | uniq -c | sort -nr | head
-n 20
272852 mal 216 // Node
163507 mal 120 // Type
137702 mal 12 // NodeList ?
106986 mal 8 // Strlit / Val ?
97424 mal 128
51894 mal 68 // Mpint
33183 mal 40 // Sym
4917 mal 13
1549 mal 16
975 mal 7
961 mal 224
817 mal 14
802 mal 11
765 mal 10
676 mal 9
561 mal 5
537 mal 15
533 mal 6
432 mal 17
405 mal 32
The biggest cost is 272,852 Node structures, consuming in excess of
50mb alone, after that the other main offenders do their share,
including 8mb of Strlit structures. Obviously any saving, no matter
how small (alignment being considered) will have a large payoff for
all the compilers.
Interestingly I applied,
https://codereview.appspot.com/6650054/, and
found no improvement, possibly because bitfields are not implemented
or come at no advantage under gcc on arm (I tried both -Os and -O3).
Suggestions warmly welcomed.
Cheers
Dave