Do not use defer in performance-sensitive contexts

This commit is contained in:
Junegunn Choi
2017-08-01 03:39:57 +09:00
parent f4b46fad27
commit 37370f057f
3 changed files with 10 additions and 8 deletions

View File

@@ -205,7 +205,6 @@ func Run(opts *Options, revision string) {
delay := true
ticks++
eventBox.Wait(func(events *util.Events) {
defer events.Clear()
for evt, value := range *events {
switch evt {
@@ -265,6 +264,7 @@ func Run(opts *Options, revision string) {
}
}
}
events.Clear()
})
if delay && reading {
dur := util.DurWithin(