Improve performance of console output watcher; work directly with bytes rather than string conversions

This commit is contained in:
Dane Everitt
2022-01-30 11:28:06 -05:00
parent fab88a380e
commit 11ae5e69ed
3 changed files with 46 additions and 29 deletions

View File

@@ -66,10 +66,10 @@ func TestSink(t *testing.T) {
g.It("removes a channel and maintains the order", func() {
channels := make([]chan []byte, 8)
for i := 0; i < len(channels); i++ {
for i := 0; i < len(channels); i++ {
channels[i] = make(chan []byte, 1)
pool.On(channels[i])
}
pool.On(channels[i])
}
g.Assert(len(pool.sinks)).Equal(8)
@@ -83,10 +83,10 @@ func TestSink(t *testing.T) {
g.It("does not panic if a nil channel is provided", func() {
ch := make([]chan []byte, 1)
defer func () {
defer func() {
if r := recover(); r != nil {
g.Fail("removing a nil channel should not cause a panic")
}
g.Fail("removing a nil channel should not cause a panic")
}
}()
pool.On(ch[0])
@@ -233,4 +233,4 @@ func TestSink(t *testing.T) {
g.Assert(MutexLocked(&pool.mu)).IsFalse()
})
})
}
}