From 150cede3f8f18f9af76df3f846636de2892192a5 Mon Sep 17 00:00:00 2001 From: Raskaro Date: Wed, 21 Aug 2019 14:05:16 +0200 Subject: [PATCH] Remove branching in fastcheckLevel() in order to speedup the function Is just a minor fix, but since I spotted it and the function is called fast*, I thought it is might worth doing ... --- log/trace.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/log/trace.go b/log/trace.go index deeaa62..e6a9635 100644 --- a/log/trace.go +++ b/log/trace.go @@ -216,8 +216,5 @@ func ErrorTracef(ctx context.Context, things ...interface{}) (ok bool) { } func fastcheckLevel(level severity) bool { - if uint32(level) < atomic.LoadUint32(logLevel) { - return false - } - return true + return uint32(level) >= atomic.LoadUint32(logLevel) }