From 3d421a853485f8d86b2133cf2480af53ba3a21f4 Mon Sep 17 00:00:00 2001 From: rjianu Date: Wed, 12 Jul 2023 16:00:55 +0300 Subject: [PATCH] chore: Add readme and benchmeme --- README.md | 17 +++++++++++++++++ benchmem.txt | 6 ++++++ 2 files changed, 23 insertions(+) create mode 100644 README.md create mode 100644 benchmem.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..cd46221 --- /dev/null +++ b/README.md @@ -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 \ No newline at end of file diff --git a/benchmem.txt b/benchmem.txt new file mode 100644 index 0000000..3c8cb2f --- /dev/null +++ b/benchmem.txt @@ -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