the motivation for this project is to understand the concepts taught in the following books:
- designing data-intensive applications
- database internals
also looking at the following for inspo:
to run tests, use go test -v ./....
github actions runs go test ./... for pushes and pull requests targeting main. to prevent failing changes from being merged, add a branch protection rule for main in github and require the test status check.
to run the skip list benchmarks, use go test ./storage/skiplist -run '^$' -bench '.' -benchmem.
BenchmarkInsertBuild/size=1000-12 8 13836212 ns/op 1000 inserts/op 13836 ns/insert 103401 B/op 2001 allocs/op
how to read benchmark results:
BenchmarkInsertBuild/size=1000-12describes the benchmark that ranBenchmarkInsertBuildis the benchmark namesize=1000means one operation creates a skip list containing 1,000 inserted values-12meansGOMAXPROCSwas 12- go was allowed to execute go code on up to 12 operating system threads at the same time
- this describes the runtime's available parallel capacity, not how many benchmark operations were running
- the benchmark uses one sequential goroutine, so it finishes each operation before beginning the next and generally only needs one thread
- the other available threads matter when code starts multiple goroutines or when a benchmark explicitly uses
b.RunParallel
8is the number of operations go ran- each operation created one skip list and performed 1,000 inserts
- 8 operations resulted in 8 separate skip lists and 8,000 total inserts
- timing measurements
13836212 ns/opmeans one complete 1,000-value build took about 13.8 milliseconds on average1000 inserts/opconfirms that each operation contained 1,000 inserts13836 ns/insertmeans one insert took about 13.8 microseconds on average
- memory measurements
103401 B/opmeans one complete build allocated about 103 kilobytes of heap memory2001 allocs/opmeans one complete build performed about 2,001 heap allocations, or roughly 2 allocations per insert