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

uber-common / zap
96%
master: 97%

Build:
Build:
LAST BUILD BRANCH: ajs-tests
DEFAULT BRANCH: master
Repo Added 06 Apr 2016 05:04AM UTC
Files 10
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

LAST BUILD ON BRANCH ajs-check
branch: ajs-check
CHANGE BRANCH
x
Reset
  • ajs-check
  • ajs-bench
  • ajs-checks
  • ajs-examples
  • ajs-floats
  • ajs-nest
  • ajs-option-docs
  • ajs-readme
  • ajs-sample
  • ajs-stacks
  • ajs-standard
  • ajs-test
  • ajs-tests
  • ajs-thingz
  • ajs-thunks
  • ajs-writers
  • err_sink
  • flag
  • level_string
  • master
  • options
  • prashant
  • stringer
  • url_escape

pending completion
182

push

travis-ci

akshayjshah
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
```

464 of 481 relevant lines covered (96.47%)

38905.77 hits per line

Relevant lines Covered
Build:
Build:
481 RELEVANT LINES 464 COVERED LINES
38905.77 HITS PER LINE
Source Files on ajs-check
  • List 0
  • Changed 5
  • Source Changed 1
  • Coverage Changed 5
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
182 ajs-check 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 fiel... push 17 May 2016 05:11AM UTC akshayjshah travis-ci pending completion  
179 ajs-check Fix serialization on tip push 10 May 2016 04:44AM UTC akshayjshah travis-ci pending completion  
177 ajs-check Add a Log method to Logger interface push 10 May 2016 04:26AM UTC akshayjshah travis-ci pending completion  
176 ajs-check WIP push 09 May 2016 11:07PM UTC akshayjshah travis-ci pending completion  
See All Builds (162)
  • Repo on GitHub
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

© 2025 Coveralls, Inc