Using advent of code to familiarize myself with golang.
- Get your inputs for each day on the official website
and add them to the respective
<year>/<day>directory. go run ./<year>/<day>/ -input=<path to puzzle input>- The answers will be printed out on the command line
Inputs are in .gitignore to not expose them as requested by the Advent of Code guy.
- I/O benchmarking blog post. Interesting read on bufio.Scanner vs os.ReadFile. Gist: bufio.Scanner is less performant than os.ReadFile but can read line by line.
- To read a whole file it can be better to use os.ReadFile like in this Stack Overflow answer.
scannerthrows error if line > 65536 characters by default. Configue according to Scanner.Buffer API.
- Benchmarking api.
- Benchmarking funcs measure the whole function, not just the loop. Reset timer after expensive set up
- Blog post on testing and benchmarking.