Skip to content

Commit

Permalink
up: update the benchmark tests package version to latest, add new tes…
Browse files Browse the repository at this point in the history
…ts log
  • Loading branch information
inhere committed Nov 8, 2022
1 parent 6f145bd commit c17c0a4
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 105 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -641,35 +641,35 @@ go test ./...
make test-bench
```

> record ad 2022.04.27
> record ad 2022.11.08
```text
```shell
% make test-bench
goos: darwin
goarch: amd64
cpu: Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz
BenchmarkZapNegative
BenchmarkZapNegative-4 128133166 93.97 ns/op 192 B/op 1 allocs/op
BenchmarkZapNegative-4 123297997 110.4 ns/op 192 B/op 1 allocs/op
BenchmarkZeroLogNegative
BenchmarkZeroLogNegative-4 909583207 13.41 ns/op 0 B/op 0 allocs/op
BenchmarkZeroLogNegative-4 891508806 13.36 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogNegative
BenchmarkPhusLogNegative-4 784099310 15.24 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogNegative-4 811990076 14.74 ns/op 0 B/op 0 allocs/op
BenchmarkLogrusNegative
BenchmarkLogrusNegative-4 289939296 41.60 ns/op 16 B/op 1 allocs/op
BenchmarkGookit_SlogNegative
> BenchmarkGookit_SlogNegative-4 29131203 417.4 ns/op 125 B/op 4 allocs/op
BenchmarkLogrusNegative-4 242633541 49.40 ns/op 16 B/op 1 allocs/op
BenchmarkGookitSlogNegative
>>> BenchmarkGookitSlogNegative-4 29102253 422.8 ns/op 125 B/op 4 allocs/op
BenchmarkZapPositive
BenchmarkZapPositive-4 9910075 1219 ns/op 192 B/op 1 allocs/op
BenchmarkZapPositive-4 9772791 1194 ns/op 192 B/op 1 allocs/op
BenchmarkZeroLogPositive
BenchmarkZeroLogPositive-4 13966810 871.0 ns/op 0 B/op 0 allocs/op
BenchmarkZeroLogPositive-4 13944360 856.8 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogPositive
BenchmarkPhusLogPositive-4 26743148 446.2 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogPositive-4 27839614 431.2 ns/op 0 B/op 0 allocs/op
BenchmarkLogrusPositive
BenchmarkLogrusPositive-4 2658482 4481 ns/op 608 B/op 17 allocs/op
BenchmarkGookit_SlogPositive
> BenchmarkGookit_SlogPositive-4 8349562 1441 ns/op 165 B/op 6 allocs/op
BenchmarkLogrusPositive-4 2621076 4583 ns/op 608 B/op 17 allocs/op
BenchmarkGookitSlogPositive
>>> BenchmarkGookitSlogPositive-4 8908768 1359 ns/op 149 B/op 5 allocs/op
PASS
ok command-line-arguments 146.669s
ok command-line-arguments 149.379s
```

## Gookit packages
Expand Down
24 changes: 12 additions & 12 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -651,35 +651,35 @@ go test -v ./...
make test-bench
```

> record ad 2022.04.27
> record ad 2022.11.08
```text
% make test-bench
goos: darwin
goarch: amd64
cpu: Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz
BenchmarkZapNegative
BenchmarkZapNegative-4 128133166 93.97 ns/op 192 B/op 1 allocs/op
BenchmarkZapNegative-4 123297997 110.4 ns/op 192 B/op 1 allocs/op
BenchmarkZeroLogNegative
BenchmarkZeroLogNegative-4 909583207 13.41 ns/op 0 B/op 0 allocs/op
BenchmarkZeroLogNegative-4 891508806 13.36 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogNegative
BenchmarkPhusLogNegative-4 784099310 15.24 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogNegative-4 811990076 14.74 ns/op 0 B/op 0 allocs/op
BenchmarkLogrusNegative
BenchmarkLogrusNegative-4 289939296 41.60 ns/op 16 B/op 1 allocs/op
BenchmarkLogrusNegative-4 242633541 49.40 ns/op 16 B/op 1 allocs/op
BenchmarkGookitSlogNegative
> BenchmarkGookitSlogNegative-4 29131203 417.4 ns/op 125 B/op 4 allocs/op
>>> BenchmarkGookitSlogNegative-4 29102253 422.8 ns/op 125 B/op 4 allocs/op
BenchmarkZapPositive
BenchmarkZapPositive-4 9910075 1219 ns/op 192 B/op 1 allocs/op
BenchmarkZapPositive-4 9772791 1194 ns/op 192 B/op 1 allocs/op
BenchmarkZeroLogPositive
BenchmarkZeroLogPositive-4 13966810 871.0 ns/op 0 B/op 0 allocs/op
BenchmarkZeroLogPositive-4 13944360 856.8 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogPositive
BenchmarkPhusLogPositive-4 26743148 446.2 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogPositive-4 27839614 431.2 ns/op 0 B/op 0 allocs/op
BenchmarkLogrusPositive
BenchmarkLogrusPositive-4 2658482 4481 ns/op 608 B/op 17 allocs/op
BenchmarkLogrusPositive-4 2621076 4583 ns/op 608 B/op 17 allocs/op
BenchmarkGookitSlogPositive
> BenchmarkGookitSlogPositive-4 8349562 1441 ns/op 165 B/op 6 allocs/op
>>> BenchmarkGookitSlogPositive-4 8908768 1359 ns/op 149 B/op 5 allocs/op
PASS
ok command-line-arguments 146.669s
ok command-line-arguments 149.379s
```

## Gookit packages
Expand Down
47 changes: 42 additions & 5 deletions _example/bench_loglibs.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
# Log libs benchmarks

Run benchmark: `make test-bench`

- on each test will update all package to latest.

## v0.3.5 - 2022.11.08

> record ad 2022.11.08
```shell
% make test-bench
goos: darwin
goarch: amd64
cpu: Intel(R) Core(TM) i7-3740QM CPU @ 2.70GHz
BenchmarkZapNegative
BenchmarkZapNegative-4 123297997 110.4 ns/op 192 B/op 1 allocs/op
BenchmarkZeroLogNegative
BenchmarkZeroLogNegative-4 891508806 13.36 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogNegative
BenchmarkPhusLogNegative-4 811990076 14.74 ns/op 0 B/op 0 allocs/op
BenchmarkLogrusNegative
BenchmarkLogrusNegative-4 242633541 49.40 ns/op 16 B/op 1 allocs/op
BenchmarkGookitSlogNegative
BenchmarkGookitSlogNegative-4 29102253 422.8 ns/op 125 B/op 4 allocs/op
BenchmarkZapPositive
BenchmarkZapPositive-4 9772791 1194 ns/op 192 B/op 1 allocs/op
BenchmarkZeroLogPositive
BenchmarkZeroLogPositive-4 13944360 856.8 ns/op 0 B/op 0 allocs/op
BenchmarkPhusLogPositive
BenchmarkPhusLogPositive-4 27839614 431.2 ns/op 0 B/op 0 allocs/op
BenchmarkLogrusPositive
BenchmarkLogrusPositive-4 2621076 4583 ns/op 608 B/op 17 allocs/op
BenchmarkGookitSlogPositive
BenchmarkGookitSlogPositive-4 8908768 1359 ns/op 149 B/op 5 allocs/op
PASS
ok command-line-arguments 149.379s
```

## v0.3.0

> record ad 2022.04.27
```text
```shell
% make test-bench
goos: darwin
goarch: amd64
Expand Down Expand Up @@ -37,7 +74,7 @@ ok command-line-arguments 146.669s

> record ad 2022.04.17
```text
```shell
$ go test -v -cpu=4 -run=none -bench=. -benchtime=10s -benchmem bench_loglibs_test.go
goos: darwin
goarch: amd64
Expand Down Expand Up @@ -71,7 +108,7 @@ ok command-line-arguments 145.175s

> record ad 2022.04.17
```text
```shell
$ go test -v -cpu=4 -run=none -bench=. -benchtime=10s -benchmem bench_loglibs_test.go
goos: darwin
goarch: amd64
Expand Down Expand Up @@ -104,7 +141,7 @@ ok command-line-arguments 156.038s

> record ad 2022.02.26
```text
```shell
$ go test -v -cpu=4 -run=none -bench=. -benchtime=10s -benchmem bench_loglibs_test.go
goos: windows
goarch: amd64
Expand Down Expand Up @@ -135,7 +172,7 @@ ok command-line-arguments 135.460s

> record ad 2022.02.26
```text
```shell
$ go test -v -cpu=4 -run=none -bench=. -benchtime=10s -benchmem bench_loglibs_test.go
goos: windows
goarch: amd64
Expand Down
9 changes: 5 additions & 4 deletions _example/bench_loglibs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ import (
"go.uber.org/zap/zapcore"
)

// in _example dir:
// In _example/ dir, run:
//
// go test -v -cpu=4 -run=none -bench=. -benchtime=10s -benchmem bench_loglibs_test.go
// go test -v -cpu=4 -run=none -bench=. -benchtime=10s -benchmem bench_loglibs_test.go
//
// code refer:
// https://github.com/phuslu/log
//
// https://github.com/phuslu/log
var msg = "The quick brown fox jumps over the lazy dog"

func BenchmarkZapNegative(b *testing.B) {
Expand Down Expand Up @@ -56,7 +57,7 @@ func BenchmarkPhusLogNegative(b *testing.B) {
}
}

// "github.com/sirupsen/logrus"
// "github.com/sirupsen/logrus"
func BenchmarkLogrusNegative(b *testing.B) {
logger := logrus.New()
logger.Out = ioutil.Discard
Expand Down
26 changes: 14 additions & 12 deletions _example/go.mod
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
module slog_example

go 1.17
go 1.18

require (
github.com/golang/glog v1.0.0
github.com/gookit/goutil v0.5.2
github.com/gookit/slog v0.3.2
github.com/gookit/goutil v0.5.15
github.com/gookit/slog v0.3.4
github.com/phuslu/log v1.0.67
github.com/rs/zerolog v1.26.1
github.com/sirupsen/logrus v1.8.1
github.com/rs/zerolog v1.28.0
github.com/sirupsen/logrus v1.9.0
github.com/syyongx/llog v0.0.0-20200222114215-e8f9f86ac0a3
go.uber.org/zap v1.21.0
go.uber.org/zap v1.23.0
)

require (
github.com/gookit/color v1.5.0 // indirect
github.com/gookit/gsr v0.0.7 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/gookit/color v1.5.2 // indirect
github.com/gookit/gsr v0.0.8 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
go.uber.org/atomic v1.9.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/text v0.4.0 // indirect
)

replace github.com/gookit/slog => ../
Loading

0 comments on commit c17c0a4

Please sign in to comment.