summaryrefslogtreecommitdiffstats
path: root/src/chunklist_test.go
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2015-04-17 22:23:52 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2015-04-17 22:23:52 +0900
commit2fe1e28220c543ddbf4e12ee7396e44ee85ad8e0 (patch)
tree82c77b5e639cd66b941356788bcb8e0e053949be /src/chunklist_test.go
parent288131ac5a895ba335681339d85ee039557490da (diff)
Improvements in performance and memory usage
I profiled fzf and it turned out that it was spending significant amount of time repeatedly converting character arrays into Unicode codepoints. This commit greatly improves search performance after the initial scan by memoizing the converted results. This commit also addresses the problem of unbounded memory usage of fzf. fzf is a short-lived process that usually processes small input, so it was implemented to cache the intermediate results very aggressively with no notion of cache expiration/eviction. I still think a proper implementation of caching scheme is definitely an overkill. Instead this commit introduces limits to the maximum size (or minimum selectivity) of the intermediate results that can be cached.
Diffstat (limited to 'src/chunklist_test.go')
-rw-r--r--src/chunklist_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/chunklist_test.go b/src/chunklist_test.go
index 02288d9f..2f8ef7e5 100644
--- a/src/chunklist_test.go
+++ b/src/chunklist_test.go
@@ -45,7 +45,7 @@ func TestChunkList(t *testing.T) {
}
// Add more data
- for i := 0; i < ChunkSize*2; i++ {
+ for i := 0; i < chunkSize*2; i++ {
cl.Push(fmt.Sprintf("item %d", i))
}
@@ -57,7 +57,7 @@ func TestChunkList(t *testing.T) {
// New snapshot
snapshot, count = cl.Snapshot()
if len(snapshot) != 3 || !snapshot[0].IsFull() ||
- !snapshot[1].IsFull() || snapshot[2].IsFull() || count != ChunkSize*2+2 {
+ !snapshot[1].IsFull() || snapshot[2].IsFull() || count != chunkSize*2+2 {
t.Error("Expected two full chunks and one more chunk")
}
if len(*snapshot[2]) != 2 {