From d6e14d7640b54272af28c996dbc25c73fff06754 Mon Sep 17 00:00:00 2001 From: Ben Boyter Date: Wed, 9 Jan 2019 18:00:41 +1100 Subject: [PATCH] Move count increment outside of loop --- processor/file.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/processor/file.go b/processor/file.go index d42bda137..7d414af70 100644 --- a/processor/file.go +++ b/processor/file.go @@ -113,14 +113,14 @@ func walkDirectoryParallel(root string, output chan *FileJob) { go func(toWalk string) { filejobs := walkDirectory(toWalk, PathBlacklist, extensionLookup) for i := 0; i < len(filejobs); i++ { - mutex.Lock() - totalCount += len(filejobs) - mutex.Unlock() - LoadLanguageFeature(filejobs[i].Language) output <- &filejobs[i] } + mutex.Lock() + totalCount += len(filejobs) + mutex.Unlock() + // Turn GC back to what it was before if we have parsed enough files if !resetGc && totalCount >= GcFileCount { debug.SetGCPercent(gcPercent)