kevwan / gobench

Write and plot your benchmark just in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gobench

Write and plot your benchmark just in Go.

How to use

package main

import (
	"math/rand"
	"time"

	"github.com/kevwan/gobench"
)

func main() {
	b := gobench.NewBench()
	b.Run(10000, func() {
		n := rand.Intn(100)
		time.Sleep(time.Millisecond * time.Duration(n))
	})
}

After running a period, you can Ctrl+C to stop the benchmark and it will automatically open your browser and show the benchmark result like below:

image

Give a Star! ⭐

If you like or are using this project to learn or start your solution, please give it a star. Thanks!

About

Write and plot your benchmark just in Go.

License:MIT License


Languages

Language:Go 100.0%