mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 05:54:59 +02:00
Avoid unnecessary copy and sort of timers
This commit is contained in:
@@ -20,7 +20,7 @@ import (
|
||||
var SIGNULL unix.Signal
|
||||
|
||||
func new_loop() *Loop {
|
||||
l := Loop{controlling_term: nil, timers_temp: make([]*timer, 4)}
|
||||
l := Loop{controlling_term: nil, timers_temp: make([]*timer, 0, 8), timers: make([]*timer, 0, 8)}
|
||||
l.terminal_options.alternate_screen = true
|
||||
l.terminal_options.restore_colors = true
|
||||
l.terminal_options.kitty_keyboard_mode = DISAMBIGUATE_KEYS | REPORT_ALTERNATE_KEYS | REPORT_ALL_KEYS_AS_ESCAPE_CODES | REPORT_TEXT_WITH_KEYS
|
||||
|
||||
@@ -50,11 +50,7 @@ func (self *Loop) dispatch_timers(now time.Time) error {
|
||||
self.timers_temp = append(self.timers_temp, t)
|
||||
}
|
||||
}
|
||||
self.timers = self.timers[:len(self.timers_temp)]
|
||||
if len(self.timers) > 0 {
|
||||
copy(self.timers, self.timers_temp)
|
||||
self.sort_timers()
|
||||
}
|
||||
self.timers, self.timers_temp = self.timers_temp, self.timers
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user