MCPcopy Create free account
hub / github.com/benbjohnson/immutable / BenchmarkMap_Iterator

Function BenchmarkMap_Iterator

immutable_test.go:1446–1464  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

1444}
1445
1446func 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
1466func BenchmarkMapBuilder_Set(b *testing.B) {
1467 b.ReportAllocs()

Callers

nothing calls this directly

Calls 4

SetMethod · 0.45
IteratorMethod · 0.45
FirstMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…