From 37dc273148df0893053bf5cda0582a23f5c2b2d2 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Fri, 19 Aug 2016 02:39:32 +0900 Subject: Micro-optimizations - Make structs smaller - Introduce Result struct and use it to represent matched items instead of reusing Item struct for that purpose - Avoid unnecessary memory allocation - Avoid growing slice from the initial capacity - Code cleanup --- src/cache_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cache_test.go') diff --git a/src/cache_test.go b/src/cache_test.go index 05f904c9..8703fc41 100644 --- a/src/cache_test.go +++ b/src/cache_test.go @@ -7,8 +7,8 @@ func TestChunkCache(t *testing.T) { chunk2 := make(Chunk, chunkSize) chunk1p := &Chunk{} chunk2p := &chunk2 - items1 := []*Item{&Item{}} - items2 := []*Item{&Item{}, &Item{}} + items1 := []*Result{&Result{}} + items2 := []*Result{&Result{}, &Result{}} cache.Add(chunk1p, "foo", items1) cache.Add(chunk2p, "foo", items1) cache.Add(chunk2p, "bar", items2) -- cgit v1.2.3