Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip low level message to avoid clock_gettime #671

Closed
wants to merge 1 commit into from

Conversation

Laisky
Copy link

@Laisky Laisky commented Jan 25, 2019

Skip lower level logs to avoid too muchtime.Now(), especially each time.Now() will invoke clock_gettime. This costs a lot of time even though there is no log match the level to print.

log

This fix will significant reduce the number of syscall and improve performance.

On my test (set log level as INFO, then invoke logger.Debug("xxx") in benchmark ):

srceen_shot 2019-01-25 at 14 28 31

@CLAassistant
Copy link

CLAassistant commented Jan 25, 2019

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jan 25, 2019

Codecov Report

Merging #671 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #671      +/-   ##
==========================================
+ Coverage   97.38%   97.38%   +<.01%     
==========================================
  Files          40       40              
  Lines        2102     2107       +5     
==========================================
+ Hits         2047     2052       +5     
  Misses         47       47              
  Partials        8        8
Impacted Files Coverage Δ
logger.go 94.73% <100%> (+0.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82e3b47...6bd4aaf. Read the comment docs.

@fgrosse
Copy link

fgrosse commented Mar 8, 2019

There was some discussion around the topic in #664 . The issue with the change is that this would break compatibility for sample based logging cores. This is however on the wishlist for 2.0 (#388)

@Laisky Laisky closed this Mar 11, 2019
@Laisky Laisky deleted the pr branch November 11, 2019 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants