mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-07 17:43:53 +02:00
Speed up write performance to loop
20x speed for large numbers of queued writes by avoiding pinging between the writer and main goroutines
This commit is contained in:
@@ -47,7 +47,8 @@ type Loop struct {
|
||||
timers, timers_temp []*timer
|
||||
timer_id_counter, write_msg_id_counter IdType
|
||||
wakeup_channel chan byte
|
||||
pending_writes []*write_msg
|
||||
pending_writes []write_msg
|
||||
tty_write_channel chan write_msg
|
||||
pending_mouse_events *utils.RingBuffer[MouseEvent]
|
||||
on_SIGTSTP func() error
|
||||
style_cache map[string]func(...any) string
|
||||
@@ -292,7 +293,7 @@ func (self *Loop) WakeupMainThread() bool {
|
||||
func (self *Loop) QueueWriteString(data string) IdType {
|
||||
self.write_msg_id_counter++
|
||||
msg := write_msg{str: data, bytes: nil, id: self.write_msg_id_counter}
|
||||
self.add_write_to_pending_queue(&msg)
|
||||
self.add_write_to_pending_queue(msg)
|
||||
return msg.id
|
||||
}
|
||||
|
||||
@@ -301,7 +302,7 @@ func (self *Loop) QueueWriteString(data string) IdType {
|
||||
func (self *Loop) UnsafeQueueWriteBytes(data []byte) IdType {
|
||||
self.write_msg_id_counter++
|
||||
msg := write_msg{bytes: data, id: self.write_msg_id_counter}
|
||||
self.add_write_to_pending_queue(&msg)
|
||||
self.add_write_to_pending_queue(msg)
|
||||
return msg.id
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user