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.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.go')
-rw-r--r-- | src/chunklist.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/chunklist.go b/src/chunklist.go index c20ffd43..a953fae9 100644 --- a/src/chunklist.go +++ b/src/chunklist.go @@ -7,7 +7,7 @@ type Chunk []*Item // >>> []Item // ItemBuilder is a closure type that builds Item object from a pointer to a // string and an integer -type ItemBuilder func([]rune, int) *Item +type ItemBuilder func([]byte, int) *Item // ChunkList is a list of Chunks type ChunkList struct { @@ -26,7 +26,7 @@ func NewChunkList(trans ItemBuilder) *ChunkList { trans: trans} } -func (c *Chunk) push(trans ItemBuilder, data []rune, index int) bool { +func (c *Chunk) push(trans ItemBuilder, data []byte, index int) bool { item := trans(data, index) if item != nil { *c = append(*c, item) @@ -53,7 +53,7 @@ func CountItems(cs []*Chunk) int { } // Push adds the item to the list -func (cl *ChunkList) Push(data []rune) bool { +func (cl *ChunkList) Push(data []byte) bool { cl.mutex.Lock() defer cl.mutex.Unlock() |