• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber-go / zap / 236
97%

Build:
DEFAULT BRANCH: master
Ran 27 May 2016 11:31PM UTC
Jobs 3
Files 11
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
236

push

travis-ci

akshayjshah
Reduce allocations for disabled/sampled logs (#45)

* Reduce allocations for disabled/sampled logs

Even when a log level is disabled or heavily sampled, calling
`logger.Error(msg, someField, someOtherField)` will make at least one
allocation to hold the fields. If we're using the more expensive field
types, we may allocate even more, only to discard all that work.

This PR introduces the `logger.Check` API, which allows particularly
performance-sensitive applications to avoid these allocations by using
a slightly wordier call pattern.

Using `Check` makes it virtually free to pass fields to a sampled
logger:

```
BenchmarkZapDisabledLevelsAddingFields-4         3000000        439 ns/op             704 B/op          2 allocs/op
BenchmarkZapDisabledLevelsCheckAddingFields-4   200000000         5.74 ns/op            0 B/op          0 allocs/op

BenchmarkZapSampleWithoutFields-4       20000000                60.9 ns/op             0 B/op          0 allocs/op
BenchmarkZapSampleCheckWithoutFields-4  20000000                61.4 ns/op             0 B/op          0 allocs/op

BenchmarkZapSampleAddingFields-4         2000000               575 ns/op             704 B/op          2 allocs/op
BenchmarkZapSampleCheckAddingFields-4   20000000                65.2 ns/op             0 B/op          0 allocs/op
```

* Improve CheckedMessage ergonomics

* Don't log on CheckedMessage re-use

24 of 24 new or added lines in 2 files covered. (100.0%)

488 of 492 relevant lines covered (99.19%)

38072.61 hits per line

Jobs
ID Job ID Ran Files Coverage
1 236.1 27 May 2016 11:31PM UTC 0
99.19
Travis Job 236.1
2 236.2 27 May 2016 11:31PM UTC 0
99.19
Travis Job 236.2
3 236.3 27 May 2016 11:32PM UTC 0
99.19
Travis Job 236.3
Source Files on build 236
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #236
  • 1392e24b on github
  • Prev Build on master (#235)
  • Next Build on master (#240)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc