August 2019
Beginner to intermediate
798 pages
17h 2m
English
As all four programs are using huge data structures, they are consuming large amounts of memory. Programs that consume lots of memory space trigger the Go garbage collector more often. So, in this subsection, we are going to compare the performance of each one of these four implementations using the time(1) command.
What will be important in the presented output is not the exact numbers but the time difference between the four different approaches. Here we go:
$ time go run sliceGC.go
real 1.50s
user 1.72s
sys 0.71s
$ time go run mapStar.go
real 13.62s
user 23.74s
sys 1.89s
$ time go run mapNoStar.go
real 11.41s
user 10.35s
sys 1.15s
$ time go run mapSplit.go
real 10.60s
user 10.01s
Read now
Unlock full access