diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-16 03:24:23 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-08-16 03:33:48 +0900 |
commit | 487c8fe88f4cfcc55850b8aef73665b1d09b8fe0 (patch) | |
tree | d21e3b4a4fdcb2a6d6980d1f47fb3ede5bd5c557 /src/constants.go | |
parent | 0d171ba1d81886c6f9caf61867129e6daa268cd6 (diff) |
Make Reader event notification asynchronous
Instead of notifying the event coordinator (EventBox) whenever a new
line is arrived, start a background goroutine that periodically does the
task. Atomic.StoreInt32 is much cheaper than mutex synchronization
that happens during EventBox update.
Diffstat (limited to 'src/constants.go')
-rw-r--r-- | src/constants.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/constants.go b/src/constants.go index 10df1e7e..0f6a32c9 100644 --- a/src/constants.go +++ b/src/constants.go @@ -16,7 +16,10 @@ const ( coordinatorDelayStep time.Duration = 10 * time.Millisecond // Reader - readerBufferSize = 64 * 1024 + readerBufferSize = 64 * 1024 + readerPollIntervalMin = 10 * time.Millisecond + readerPollIntervalStep = 5 * time.Millisecond + readerPollIntervalMax = 50 * time.Millisecond // Terminal initialDelay = 20 * time.Millisecond @@ -68,7 +71,7 @@ const ( EvtSearchProgress EvtSearchFin EvtHeader - EvtClose + EvtReady ) const ( |