Skip to content

Commit

Permalink
BCache
Browse files Browse the repository at this point in the history
  • Loading branch information
lemon-mint committed Feb 26, 2023
1 parent e972379 commit afcdbd3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
Empty file added cache/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions cache/bcache/bcache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package bcache

import "sync"

type BCache struct {
}

type bucket struct {
l sync.Mutex
}
39 changes: 39 additions & 0 deletions sync2/lock_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package sync2_test

import (
"sync"
"testing"
)

func BenchmarkSyncMutexLockUnlock(b *testing.B) {
m := &sync.Mutex{}
b.SetBytes(1)
b.RunParallel(func(p *testing.PB) {
for p.Next() {
m.Lock()
m.Unlock()
}
})
}

func BenchmarkSyncRWMutexLockUnlock(b *testing.B) {
m := &sync.RWMutex{}
b.SetBytes(1)
b.RunParallel(func(p *testing.PB) {
for p.Next() {
m.Lock()
m.Unlock()
}
})
}

func BenchmarkSyncRWMutexRLockRUnlock(b *testing.B) {
m := &sync.RWMutex{}
b.SetBytes(1)
b.RunParallel(func(p *testing.PB) {
for p.Next() {
m.RLock()
m.RUnlock()
}
})
}
1 change: 0 additions & 1 deletion wyhash-js
Submodule wyhash-js deleted from 8531e3

0 comments on commit afcdbd3

Please sign in to comment.