Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ go 1.15

require (
github.com/alecthomas/kong v0.2.12
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/olekukonko/tablewriter v0.0.4
github.com/stretchr/testify v1.5.1
github.com/willabides/mdtable v0.1.0
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/perf v0.0.0-20201207232921-bdcc6220ee90
)
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ github.com/gonum/internal v0.0.0-20181124074243-f884aa714029/go.mod h1:Pu4dmpkhS
github.com/gonum/lapack v0.0.0-20181123203213-e4cdc5a0bff9/go.mod h1:XA3DeT6rxh2EAE789SSiSJNqxPaC0aE9J8NTOI0Jo/A=
github.com/gonum/matrix v0.0.0-20181209220409-c518dec07be9/go.mod h1:0EXg4mc1CNP0HCqCz+K4ts155PXIlUywf0wqN+GfPZw=
github.com/googleapis/gax-go v0.0.0-20161107002406-da06d194a00e/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8=
github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand All @@ -30,6 +27,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/willabides/mdtable v0.1.0 h1:HYh3JNOrKtrnmt8I8LjtN4mBHcrj3V5+53ZZ/uyozoA=
github.com/willabides/mdtable v0.1.0/go.mod h1:o8N6onDZrqSMKjabh3V4Ela8/QODQAs7IxTvkU/uKgY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down
25 changes: 13 additions & 12 deletions pkg/benchstatter/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strconv"
"strings"

"github.com/olekukonko/tablewriter"
"github.com/willabides/mdtable"
"golang.org/x/perf/benchstat"
)

Expand Down Expand Up @@ -76,6 +76,7 @@ func csv2Markdown(data []byte) ([]string, error) {

var mdTable string
mdTable, err = buildMD(rows)
mdTable += "\n"
if err != nil {
return nil, err
}
Expand All @@ -85,20 +86,20 @@ func csv2Markdown(data []byte) ([]string, error) {
}

func buildMD(rows [][]string) (string, error) {
var buf bytes.Buffer
if len(rows) < 2 {
return "", fmt.Errorf("need at least one row plus header")
}
hRow := rows[0]
rows = rows[1:]
table := tablewriter.NewWriter(&buf)
table.SetHeader(hRow)
table.SetAutoFormatHeaders(false)
table.SetBorders(tablewriter.Border{Left: true, Top: false, Right: true, Bottom: false})
table.SetCenterSeparator("|")
table.AppendBulk(rows)
table.Render()
return buf.String(), nil

table := new(mdtable.Table)
table.SetHeaderAlignment(mdtable.AlignCenter)
table.SetData(rows)
for i, s := range rows[0] {
if strings.Contains(s, "(") {
table.SetColumnAlignment(i, mdtable.AlignRight)
}
}

return string(table.Render()), nil
}

// MarkdownFormatterOptions options for a markdown OutputFormatter
Expand Down
4 changes: 2 additions & 2 deletions pkg/benchstatter/testdata/_golden-example-norange.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
| name | old time/op (ns/op) | new time/op (ns/op) | delta | |
|------------|---------------------|---------------------|---------|-----------------|
|------------|--------------------:|--------------------:|---------|-----------------|
| GobEncode | 13599100 | 11789300 | -13.31% | (p=0.016 n=4+5) |
| JSONEncode | 32114300 | 31761400 | ~ | (p=0.286 n=4+5) |

| name | old speed (MB/s) | new speed (MB/s) | delta | |
|------------|------------------|------------------|---------|-----------------|
|------------|-----------------:|-----------------:|---------|-----------------|
| GobEncode | 56.44 | 65.108 | +15.36% | (p=0.016 n=4+5) |
| JSONEncode | 60.4275 | 61.102 | ~ | (p=0.286 n=4+5) |
4 changes: 2 additions & 2 deletions pkg/benchstatter/testdata/_golden-example.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
| name | old time/op (ns/op) | ± | new time/op (ns/op) | ± | delta | ± |
|------------|---------------------|----|---------------------|----|---------|-----------------|
|------------|--------------------:|----|--------------------:|----|---------|-----------------|
| GobEncode | 13599100 | 1% | 11789300 | 1% | -13.31% | (p=0.016 n=4+5) |
| JSONEncode | 32114300 | 1% | 31761400 | 1% | ~ | (p=0.286 n=4+5) |

| name | old speed (MB/s) | ± | new speed (MB/s) | ± | delta | ± |
|------------|------------------|----|------------------|----|---------|-----------------|
|------------|-----------------:|----|-----------------:|----|---------|-----------------|
| GobEncode | 56.44 | 1% | 65.108 | 1% | +15.36% | (p=0.016 n=4+5) |
| JSONEncode | 60.4275 | 1% | 61.102 | 2% | ~ | (p=0.286 n=4+5) |
4 changes: 2 additions & 2 deletions pkg/benchstatter/testdata/_golden-oldnew.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| name | old time/op (ns/op) | ± | new time/op (ns/op) | ± | delta | ± |
|-------------------------------------------|---------------------|-----|---------------------|-----|---------|-------------------|
|-------------------------------------------|--------------------:|-----|--------------------:|-----|---------|-------------------|
| CRC32/poly=IEEE/size=15/align=0-8 | 46.87 | 8% | 44.52 | 3% | -5.01% | (p=0.008 n=10+10) |
| CRC32/poly=IEEE/size=15/align=1-8 | 44.71 | 5% | 44.5 | 4% | ~ | (p=0.539 n=10+10) |
| CRC32/poly=IEEE/size=40/align=0-8 | 41.0375 | 1% | 42.5 | 6% | +3.56% | (p=0.000 n=8+10) |
Expand Down Expand Up @@ -38,7 +38,7 @@
| CRC32/poly=Koopman/size=32kB/align=1-8 | 69619.4 | 3% | 74280.9 | 3% | +6.70% | (p=0.000 n=8+10) |

| name | old speed (MB/s) | ± | new speed (MB/s) | ± | delta | ± |
|-------------------------------------------|------------------|-----|------------------|-----|----------|-------------------|
|-------------------------------------------|-----------------:|-----|-----------------:|-----|----------|-------------------|
| CRC32/poly=IEEE/size=15/align=0-8 | 320.711 | 8% | 336.95 | 3% | +5.06% | (p=0.009 n=10+10) |
| CRC32/poly=IEEE/size=15/align=1-8 | 335.516 | 4% | 337.066 | 4% | ~ | (p=0.579 n=10+10) |
| CRC32/poly=IEEE/size=40/align=0-8 | 974.718 | 1% | 941.823 | 5% | -3.37% | (p=0.001 n=8+10) |
Expand Down
8 changes: 4 additions & 4 deletions pkg/benchstatter/testdata/_golden-oldnewgeo.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| name | old time/op (ns/op) | ± | new time/op (ns/op) | ± | delta | ± |
|-------------------------------------------|---------------------|-----|---------------------|-----|---------|-------------------|
|-------------------------------------------|--------------------:|-----|--------------------:|-----|---------|-------------------|
| CRC32/poly=IEEE/size=15/align=0-8 | 46.87 | 8% | 44.52 | 3% | -5.01% | (p=0.008 n=10+10) |
| CRC32/poly=IEEE/size=15/align=1-8 | 44.71 | 5% | 44.5 | 4% | ~ | (p=0.539 n=10+10) |
| CRC32/poly=IEEE/size=40/align=0-8 | 41.0375 | 1% | 42.5 | 6% | +3.56% | (p=0.000 n=8+10) |
Expand Down Expand Up @@ -36,10 +36,10 @@
| CRC32/poly=Koopman/size=4kB/align=1-8 | 8940.2 | 10% | 9046.3 | 12% | ~ | (p=0.754 n=10+10) |
| CRC32/poly=Koopman/size=32kB/align=0-8 | 72428 | 9% | 72900.5 | 4% | ~ | (p=0.684 n=10+10) |
| CRC32/poly=Koopman/size=32kB/align=1-8 | 69619.4 | 3% | 74280.9 | 3% | +6.70% | (p=0.000 n=8+10) |
| [Geo mean] | 344.668 | | 237.855 | | -30.99% |
| [Geo mean] | 344.668 | | 237.855 | | -30.99% | |

| name | old speed (MB/s) | ± | new speed (MB/s) | ± | delta | ± |
|-------------------------------------------|------------------|-----|------------------|-----|----------|-------------------|
|-------------------------------------------|-----------------:|-----|-----------------:|-----|----------|-------------------|
| CRC32/poly=IEEE/size=15/align=0-8 | 320.711 | 8% | 336.95 | 3% | +5.06% | (p=0.009 n=10+10) |
| CRC32/poly=IEEE/size=15/align=1-8 | 335.516 | 4% | 337.066 | 4% | ~ | (p=0.579 n=10+10) |
| CRC32/poly=IEEE/size=40/align=0-8 | 974.718 | 1% | 941.823 | 5% | -3.37% | (p=0.001 n=8+10) |
Expand Down Expand Up @@ -76,4 +76,4 @@
| CRC32/poly=Koopman/size=4kB/align=1-8 | 459.394 | 9% | 454.627 | 11% | ~ | (p=0.739 n=10+10) |
| CRC32/poly=Koopman/size=32kB/align=0-8 | 453.471 | 8% | 449.828 | 4% | ~ | (p=0.684 n=10+10) |
| CRC32/poly=Koopman/size=32kB/align=1-8 | 470.784 | 3% | 441.379 | 3% | -6.25% | (p=0.000 n=8+10) |
| [Geo mean] | 1712.21 | | 2480.66 | | +44.88% |
| [Geo mean] | 1712.21 | | 2480.66 | | +44.88% | |
8 changes: 4 additions & 4 deletions pkg/benchstatter/testdata/_golden-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ goos: darwin
note: hw acceleration enabled

| name | old time/op (ns/op) | ± | new time/op (ns/op) | ± | delta | ± |
|-----------|---------------------|----|---------------------|----|---------|-----------------|
|-----------|--------------------:|----|--------------------:|----|---------|-----------------|
| GobEncode | 13599100 | 1% | 11789300 | 1% | -13.31% | (p=0.016 n=4+5) |

| name | old speed (MB/s) | ± | new speed (MB/s) | ± | delta | ± |
|-----------|------------------|----|------------------|----|---------|-----------------|
|-----------|-----------------:|----|-----------------:|----|---------|-----------------|
| GobEncode | 56.44 | 1% | 65.108 | 1% | +15.36% | (p=0.016 n=4+5) |

pkg: encoding/json
goos: darwin
note: hw acceleration enabled

| name | old time/op (ns/op) | ± | new time/op (ns/op) | ± | delta | ± |
|------------|---------------------|----|---------------------|----|-------|-----------------|
|------------|--------------------:|----|--------------------:|----|-------|-----------------|
| JSONEncode | 32114300 | 1% | 31761400 | 1% | ~ | (p=0.286 n=4+5) |

| name | old speed (MB/s) | ± | new speed (MB/s) | ± | delta | ± |
|------------|------------------|----|------------------|----|-------|-----------------|
|------------|-----------------:|----|-----------------:|----|-------|-----------------|
| JSONEncode | 60.4275 | 1% | 61.102 | 2% | ~ | (p=0.286 n=4+5) |