diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2015-08-02 14:25:57 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2015-08-02 14:25:57 +0900 |
commit | e13bafc1abaea9a9f3142eb58be1e977ca97e114 (patch) | |
tree | 98c07483e3fb5057feb8c8854d51034c0856b08c /src/chunklist_test.go | |
parent | 0ea66329b84cc6e4f8ff61ee99c00bb238070247 (diff) |
Performance fix - unnecessary rune convertion on --ansi
> time cat /tmp/list | fzf-0.10.1-darwin_amd64 --ansi -fqwerty > /dev/null
real 0m4.364s
user 0m8.231s
sys 0m0.820s
> time cat /tmp/list | fzf --ansi -fqwerty > /dev/null
real 0m4.624s
user 0m5.755s
sys 0m0.732s
Diffstat (limited to 'src/chunklist_test.go')
-rw-r--r-- | src/chunklist_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/chunklist_test.go b/src/chunklist_test.go index faaf04fe..26795ef2 100644 --- a/src/chunklist_test.go +++ b/src/chunklist_test.go @@ -6,8 +6,8 @@ import ( ) func TestChunkList(t *testing.T) { - cl := NewChunkList(func(s []rune, i int) *Item { - return &Item{text: s, rank: Rank{0, 0, uint32(i * 2)}} + cl := NewChunkList(func(s []byte, i int) *Item { + return &Item{text: []rune(string(s)), rank: Rank{0, 0, uint32(i * 2)}} }) // Snapshot @@ -17,8 +17,8 @@ func TestChunkList(t *testing.T) { } // Add some data - cl.Push([]rune("hello")) - cl.Push([]rune("world")) + cl.Push([]byte("hello")) + cl.Push([]byte("world")) // Previously created snapshot should remain the same if len(snapshot) > 0 { @@ -46,7 +46,7 @@ func TestChunkList(t *testing.T) { // Add more data for i := 0; i < chunkSize*2; i++ { - cl.Push([]rune(fmt.Sprintf("item %d", i))) + cl.Push([]byte(fmt.Sprintf("item %d", i))) } // Previous snapshot should remain the same @@ -64,8 +64,8 @@ func TestChunkList(t *testing.T) { t.Error("Unexpected number of items") } - cl.Push([]rune("hello")) - cl.Push([]rune("world")) + cl.Push([]byte("hello")) + cl.Push([]byte("world")) lastChunkCount := len(*snapshot[len(snapshot)-1]) if lastChunkCount != 2 { |