prettybenchmarks

command module
v0.0.0-...-b2ec4e5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

README

Prettybenchmarks

Prettybenchmarks formats your go benchmarks into nice looking sorted tables

Installation

go get github.com/florianorben/prettybenchmarks/cmd/pb

Usage

Pipe go bench results into "pb"

Works with and without -benchmem flag

If you provide a time interval (either ns, µs (or us), ms, s), each benchmark's runtime will be converted to that interval. If left blank, a suitable value will automatically be chosen

go test -bench=YOUR_PKG [-benchmem] | pb [timeinterval]

Example:

go test -bench=. -benchmem | pb ms

Features

  • Removes clutter in benchmark's names (e.g. Benchmark_, -8 etc.)
  • Automatically groups benchmarks if you use Benchmark_FN_XXX notation, where XXX is the number of iterations you run the benchmark (see screenshots)
  • Optionally convert ns runtime values into a more-readable value (>1000 µs, > 1000000 ms, > 1000000000 s)
  • Prints a table ;)

Screenshots

Before

Before

After

After

Misc

Shoutout to panicparse for giving me some inspiration


Build Status

Documentation

Overview

Package prettybenchmarks formats your go benchmarks into nice looking sorted tables

Prettybenchmarks

Works with and without -benchmem flag

If you provide a time interval (either ns, µs (or us), ms, s), each benchmark's runtime will be converted to that interval. If left blank, a suitable value will automatically be chosen

go test -bench=YOUR_PKG [-benchmem] | pb [timeinterval]

Example

go test -bench=. -benchmem | pb ms

Turns

Benchmark_NewSmallReq-8      	  100000	     21618 ns/op	    2739 B/op	      45 allocs/op
BenchmarkNewLargeReq-8      	   10000	    122245 ns/op	   29823 B/op	      54 allocs/op
Benchmark_NewSmallReqProto-8 	  100000	     15594 ns/op	    2691 B/op	      44 allocs/op

into

+-----------------------+---------+---------+--------+----------------+
| Name                  |    Runs |   µs/op |   B/op | allocations/op |
+-----------------------+---------+---------+--------+----------------+
| NewLargeReq           |  10,000 | 109.805 | 29,823 |             54 |
+-----------------------+---------+---------+--------+----------------+
| NewSmallReq           | 100,000 |  14.122 |  2,739 |             45 |
+-----------------------+---------+---------+--------+----------------+
| NewSmallReqProto      | 100,000 |  13.959 |  2,691 |             44 |
+-----------------------+---------+---------+--------+----------------+

Directories

Path Synopsis
cmd
pb
Prettybenchmarks formats your go benchmarks into nice looking sorted tables Prettybenchmarks Works with and without -benchmem flag If you provide a time interval (either ns, µs (or us), ms, s), each benchmark's runtime will be converted to that interval.
Prettybenchmarks formats your go benchmarks into nice looking sorted tables Prettybenchmarks Works with and without -benchmem flag If you provide a time interval (either ns, µs (or us), ms, s), each benchmark's runtime will be converted to that interval.
Package prettybenchmarks formats your go benchmarks into nice looking sorted tables Prettybenchmarks Works with and without -benchmem flag If you provide a time interval (either ns, µs (or us), ms, s), each benchmark's runtime will be converted to that interval.
Package prettybenchmarks formats your go benchmarks into nice looking sorted tables Prettybenchmarks Works with and without -benchmem flag If you provide a time interval (either ns, µs (or us), ms, s), each benchmark's runtime will be converted to that interval.

Jump to

Keyboard shortcuts

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