Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
32e2517
introduced private set without lock
andectionsharechat Jul 24, 2023
eb82c00
naive batch write implementation
andectionsharechat Jul 24, 2023
18a0729
small cleans
andectionsharechat Jul 24, 2023
1eef94d
fixed writing cache error
andectionsharechat Jul 24, 2023
675daf7
updated go modele name
andectionsharechat Jul 24, 2023
b173153
increased timer interval
andectionsharechat Jul 25, 2023
1638d94
updated parameters a bit
andectionsharechat Jul 25, 2023
cf5459d
tuned contention parameters
andectionsharechat Jul 26, 2023
5f66907
removed useless set
andectionsharechat Jul 27, 2023
250649c
updated package name
andectionsharechat Jul 27, 2023
2b137a7
fixed tests
andectionsharechat Jul 27, 2023
254b7f2
fixed tests
andectionsharechat Jul 27, 2023
2cc0b1b
updated module name
andectionsharechat Jul 27, 2023
28aff5b
fixed big cache panic
andectionsharechat Aug 3, 2023
0b54936
fixed all tests
andectionsharechat Aug 4, 2023
0c369fe
changed bucket to 512
andectionsharechat Aug 4, 2023
75755e0
fixed tests
andectionsharechat Aug 4, 2023
45f5fb1
fixed race condition
andectionsharechat Aug 5, 2023
02823fe
increase go version
andectionsharechat Aug 5, 2023
3d79619
fixed go version in ci
andectionsharechat Aug 5, 2023
5da66c8
fixed test
andectionsharechat Aug 5, 2023
575c5b2
code clean
andectionsharechat Aug 5, 2023
fd775cd
code clean
andectionsharechat Aug 5, 2023
182b934
cleaned code
andectionsharechat Aug 5, 2023
81828ae
fixing tests
andectionsharechat Aug 6, 2023
c745332
code clean
andectionsharechat Aug 6, 2023
3dcc29a
stabilize tests
andectionsharechat Aug 6, 2023
835b2ac
added sync write
andectionsharechat Aug 6, 2023
0808cce
simplifed tests
andectionsharechat Aug 6, 2023
7e2ea4a
drop on high contention
andectionsharechat Aug 8, 2023
f7ed73e
added drop writes stats
andectionsharechat Aug 9, 2023
8d1a9a8
reduced buffer size
andectionsharechat Aug 9, 2023
9f93372
increased buffer size
andectionsharechat Aug 9, 2023
ad4b5db
collect write queue stats
andectionsharechat Aug 10, 2023
4c8deac
increased bucket count
andectionsharechat Aug 10, 2023
d0bf3a3
reduced bucket count
andectionsharechat Aug 10, 2023
dcbd030
make deduplication
andectionsharechat Aug 11, 2023
86699e3
increased init size of buffer
andectionsharechat Aug 11, 2023
b6546b1
huge number of buckets
andectionsharechat Aug 11, 2023
10a73ae
updated bucket count
andectionsharechat Aug 11, 2023
0c37dc8
reduced critical section
andectionsharechat Aug 11, 2023
28daa89
Added naive limiter
andectionsharechat Aug 11, 2023
137c9dd
improved dedup logic
andectionsharechat Aug 15, 2023
b0eb5b5
removed limiter
andectionsharechat Aug 15, 2023
36f55a0
fixed dedup logic
andectionsharechat Aug 15, 2023
5ecf4b9
small optimisation
andectionsharechat Aug 15, 2023
73c032b
intorduced limiter
andectionsharechat Aug 15, 2023
3d75efe
fixed test
andectionsharechat Aug 15, 2023
bb440b1
removed hash and pointer allocation
andectionsharechat Aug 15, 2023
df043b8
rollback idea of smart dedup
andectionsharechat Aug 15, 2023
1689be0
reduced memory allocation
andectionsharechat Aug 15, 2023
c6c650a
fixed limiter
andectionsharechat Aug 15, 2023
a9546ef
increased bucket count
andectionsharechat Aug 15, 2023
cc8bfba
removing limiting
andectionsharechat Aug 16, 2023
a8217bd
bucket count
andectionsharechat Aug 18, 2023
5424c8b
added bucket stats
andectionsharechat Aug 18, 2023
a999d32
added naive l1 cache
andectionsharechat Aug 18, 2023
e017d70
added L1 cache
andectionsharechat Aug 18, 2023
2683f32
increased bucket count
andectionsharechat Aug 18, 2023
df28b0f
reduced memory traffic
andectionsharechat Aug 18, 2023
0d1b8e5
added pooling
andectionsharechat Aug 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: 1.17
id: go
- name: Code checkout
uses: actions/checkout@v1
- name: Test
run: |
go test -v ./... -coverprofile=coverage.txt -covermode=atomic
go test -v ./... -race
- name: Build
run: |
Expand Down
9 changes: 4 additions & 5 deletions bigcache.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package fastcache
package turbocache

import (
xxhash "github.com/cespare/xxhash/v2"
"sync"
"sync/atomic"

xxhash "github.com/cespare/xxhash/v2"
)

// maxSubvalueLen is the maximum size of subvalue chunk.
Expand Down Expand Up @@ -55,13 +54,13 @@ func (c *Cache) SetBig(k, v []byte) {
}
subvalue := v[:subvalueLen]
v = v[subvalueLen:]
c.Set(subkey.B, subvalue)
c.setSync(subkey.B, subvalue)
}

// Write metavalue, which consists of valueHash and valueLen.
subkey.B = marshalUint64(subkey.B[:0], valueHash)
subkey.B = marshalUint64(subkey.B, uint64(valueLen))
c.Set(k, subkey.B)
c.setSync(k, subkey.B)
putSubkeyBuf(subkey)
}

Expand Down
6 changes: 3 additions & 3 deletions bigcache_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fastcache
package turbocache

import (
"bytes"
Expand All @@ -7,7 +7,7 @@ import (
)

func TestSetGetBig(t *testing.T) {
c := New(256 * 1024 * 1024)
c := New(NewConfig(256*1024*1024, 3, 100))
const valuesCount = 10
for _, valueSize := range []int{1, 100, 1<<16 - 1, 1 << 16, 1<<16 + 1, 1 << 17, 1<<17 + 1, 1<<17 - 1, 1 << 19} {
t.Run(fmt.Sprintf("valueSize_%d", valueSize), func(t *testing.T) {
Expand All @@ -32,7 +32,7 @@ func testSetGetBig(t *testing.T, c *Cache, valueSize, valuesCount, seed int) {
}
}
var s Stats
c.UpdateStats(&s)
c.UpdateStats(&s, false)
if s.SetBigCalls < uint64(valuesCount) {
t.Fatalf("expecting SetBigCalls >= %d; got %d", valuesCount, s.SetBigCalls)
}
Expand Down
6 changes: 3 additions & 3 deletions bigcache_timing_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fastcache
package turbocache

import (
"testing"
Expand All @@ -7,7 +7,7 @@ import (
func BenchmarkSetBig(b *testing.B) {
key := []byte("key12345")
value := createValue(256*1024, 0)
c := New(1024 * 1024)
c := New(NewSyncWriteConfig(1024 * 1024))
b.SetBytes(int64(len(value)))
b.ReportAllocs()
b.RunParallel(func(pb *testing.PB) {
Expand All @@ -20,7 +20,7 @@ func BenchmarkSetBig(b *testing.B) {
func BenchmarkGetBig(b *testing.B) {
key := []byte("key12345")
value := createValue(265*1024, 0)
c := New(1024 * 1024)
c := New(NewSyncWriteConfig(1024 * 1024))
c.SetBig(key, value)
b.SetBytes(int64(len(value)))
b.ReportAllocs()
Expand Down
Loading