benchx-cli

command module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2022 License: MIT Imports: 2 Imported by: 0

README

BENCHX CLI Go Report Card

Benchx is a command line tool which provides a handy experience for generating benchmark graphs by examining the output of:

go test ./... -bench . -benchmem The graphs are stored at ./benchx-graphs by default. At this time this is not configurable.

Usage

Benchmark Naming Conventions

benchx-cli will examine the test names from the output of go test ./... -bench . -benchmem. The naming schema of the benchmark is:

    1        2       3
__________________________
|        |        |      |
BenchmarkFibonacciRecusion

Three parts of the naming conventions are:

  1. every benchmark must start with Benchmark keyword
  2. the second part can act as a group identifier; in such case all groups must be acknowledged by using --groups flag and should be separated using space
  3. is the name of the benchmark case
Comands
Flags:
  -h, --help    Show context-sensitive help.

Commands:
  run
    Run benchmarks

At this time, the benchx-cli has only one command. This commands has a flag called groups which you can use to group your benchmarks according to the Name Conventions.

Example

To demonstrate the functionality of benchx-cli a fibonacci benchmark is performed to compare the performance between loop vs recursion implementation.

Test code

func BenchmarkFibonacciRecursion(b *testing.B) {
	for i := 0; i < b.N; i++ {
		_ = FibonacciRecursion(10)
	}
}

func BenchmarkFibonacciLoop(b *testing.B) {
	for i := 0; i < b.N; i++ {
		_ = FibonacciLoop(10)
	}
}

The following command is used to run and generate benchmark graphs:

benchx-cli run --groups Fibonacci

The following graphs are generated:

Iterations Speed Memory Allocations

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL