Emmanuel T Odeke
1e0efb6758
libs/log: use fmt.Fprintf directly with *bytes.Buffer to avoid unnecessary allocations ( #6503 )
Noticed from profiling that the loggers are memory hungry and alas,
we were passing fmt.Sprintf strings to (*bytes.Buffer).WriteString
which defeats the purpose of using fmt.* This change fixes that and
instead directly invokes fmt.Fprintf.
The benchmarks show the improvement:
```shell
$ benchstat before.txt after.txt
name old time/op new time/op delta
TMLoggerSimple-8 1.67µs ± 4% 1.69µs ±13% ~ (p=0.118 n=20+19)
TMLoggerContextual-8 2.01µs ± 8% 1.94µs ± 1% -3.79% (p=0.000 n=18+20)
TMFmtLoggerSimple-8 1.20µs ± 3% 1.16µs ± 2% -3.39% (p=0.000 n=20+16)
TMFmtLoggerContextual-8 1.53µs ±19% 1.43µs ±13% -6.10% (p=0.001 n=20+20)
name old alloc/op new alloc/op delta
TMLoggerSimple-8 696B ± 0% 616B ± 0% -11.49% (p=0.000 n=20+20)
TMLoggerContextual-8 1.02kB ± 0% 0.94kB ± 0% -7.87% (p=0.000 n=20+20)
TMFmtLoggerSimple-8 240B ± 0% 160B ± 0% -33.33% (p=0.000 n=20+20)
TMFmtLoggerContextual-8 416B ± 0% 336B ± 0% -19.23% (p=0.000 n=20+20)
name old allocs/op new allocs/op delta
TMLoggerSimple-8 13.0 ± 0% 12.0 ± 0% -7.69% (p=0.000 n=20+20)
TMLoggerContextual-8 17.0 ± 0% 16.0 ± 0% -5.88% (p=0.000 n=20+20)
TMFmtLoggerSimple-8 6.00 ± 0% 5.00 ± 0% -16.67% (p=0.000 n=20+20)
TMFmtLoggerContextual-8 8.00 ± 0% 7.00 ± 0% -12.50% (p=0.000 n=20+20)
```
Fixes #6502
4 years ago
Anton Kaliaev
d76add65a6
libs/log: format []byte as hexidecimal string (uppercased) ( #5960 )
Closes : #5806
Co-authored-by: Lanie Hei <heixx011@umn.edu>
4 years ago
Marko
7e2cc1db5e
linter: (1/2) enable errcheck ( #5064 )
## Description
partially cleanup in preparation for errcheck
i ignored a bunch of defer errors in tests but with the update to go 1.14 we can use `t.Cleanup(func() { if err := <>; err != nil {..}}` to cover those errors, I will do this in pr number two of enabling errcheck.
ref #5059
5 years ago
Marko
f9cce282da
gocritic (2/2) ( #3864 )
Refs #3262
5 years ago
Anton Kaliaev
5f4d8e031e
[log] fix year format ( #3125 )
Refs #3060
6 years ago
yutianwu
60437953ac
[R4R] libs/log: add year to log format ( #2707 )
* add year to log format
* update documentation
6 years ago
Zarko Milosevic
7b88172f41
Implement BFT time ( #2203 )
* Implement BFT time
* set LastValidators when creating state in state helper
for heights >= 2
6 years ago
Zach Ramsay
44dad6d70b
Revert "detele everything"
This reverts commit d02c5d1e30
.
7 years ago
Zach Ramsay
d02c5d1e30
detele everything
7 years ago
Ethan Buchman
ae3bf81833
mv tmlibs files to libs dir
7 years ago
Anton Kaliaev
69447564b8
encode complex types as "%+v" (Refs #18 )
7 years ago
Zach Ramsay
d6e03d2368
linting: add to Makefile & do some fixes
7 years ago
Anton Kaliaev
f202d02d0d
[log] add separator
8 years ago
Anton Kaliaev
b2a116863c
squash module key if multiple keyvals were provided
last keyvalue wins
8 years ago
Anton Kaliaev
2bf6ebf379
filter
8 years ago
Ethan Buchman
66c9401c07
log: Tm -> TM
8 years ago
Anton Kaliaev
ed76afd409
Logger interface and tmLogger impl based on go-kit
8 years ago