An initial implementation of CountWord function is provided
Implement a test for the CountWord function
Benchmark your CountWord function.
Is it cpu or memory bound?
Using benchstat checkout to variation and make sure you have a solid measurement.
Can you speed up your initial implementation?
Implement and test a second implementation.
Using benchstat compare your first and second implementations.
Setup
# Install benchstat
# IMPORTANT! Make sure GOBIN is set to $HOME/gopherland/bin and is in your PATH!!
go env GOBIN
# Set if NOT SET!
go env -w GOBIN=$HOME/gopherland/bin
go get -u golang.org/x/perf/cmd/benchstat
Commands
# Normalize output so they have the same benchmark name
sed -i '' 's/V1//g' v1.out && sed -i '' 's/V2//g' v2.out