(b *testing.B)
| 1444 | } |
| 1445 | |
| 1446 | func BenchmarkMap_Iterator(b *testing.B) { |
| 1447 | const n = 10000 |
| 1448 | m := NewMap[int, int](nil) |
| 1449 | for i := 0; i < 10000; i++ { |
| 1450 | m = m.Set(i, i) |
| 1451 | } |
| 1452 | b.ReportAllocs() |
| 1453 | b.ResetTimer() |
| 1454 | |
| 1455 | b.Run("Forward", func(b *testing.B) { |
| 1456 | itr := m.Iterator() |
| 1457 | for i := 0; i < b.N; i++ { |
| 1458 | if i%n == 0 { |
| 1459 | itr.First() |
| 1460 | } |
| 1461 | itr.Next() |
| 1462 | } |
| 1463 | }) |
| 1464 | } |
| 1465 | |
| 1466 | func BenchmarkMapBuilder_Set(b *testing.B) { |
| 1467 | b.ReportAllocs() |