chore: Add readme and benchmeme

This commit is contained in:
rjianu
2023-07-12 16:00:55 +03:00
parent 9fec648bc8
commit 3d421a8534
2 changed files with 23 additions and 0 deletions

17
README.md Normal file
View File

@@ -0,0 +1,17 @@
### reading csv's
How to benchmark:
- There is a test in the `main_test.go` file containing a benchmark loop
- run the command `go test -bench . -run ^$` to run only the benchmark test
- you can make the bench tool run more iterations of the benchmark using a flag on the command:
`go test -bench . -benchtime10x -run ^$`
- to profile the program run `go test -bench . -benchtime=10x -run ^$ -cpuprofile cpu00.pprof`
The above command will generate two files that will be used for profiling the program
To use the generated files for profiling you have to run:
`go tool pprof cpu00.pprof`
This will start an interactive cli session where you can view more details about the functions running in the program
Inside that interactive cli session you can use the `top` and `list` commands to see details of the functions that are running

6
benchmem.txt Normal file
View File

@@ -0,0 +1,6 @@
goos: linux
goarch: amd64
pkg: github.com/Serares/coolStats
BenchmarkRun-16 10 326381958 ns/op 495568278 B/op 5041037 allocs/op
PASS
ok github.com/Serares/coolStats 3.596s