(b *testing.B)
| 539 | } |
| 540 | |
| 541 | func Benchmark_LoadSyncMap(b *testing.B) { |
| 542 | var m sync.Map |
| 543 | for i := 0; i < boundaryShardSetLen; i++ { |
| 544 | m.Store(i, &shard{}) |
| 545 | } |
| 546 | // 8.435 ns |
| 547 | b.RunParallel(func(pb *testing.PB) { |
| 548 | for pb.Next() { |
| 549 | item, ok := m.Load(boundaryShardSetLen - 1) |
| 550 | if ok { |
| 551 | _, _ = item.(*shard) |
| 552 | } |
| 553 | } |
| 554 | }) |
| 555 | } |
| 556 | |
| 557 | func Benchmark_LoadAtomicValue(b *testing.B) { |
| 558 | var v atomic.Value |