Skip to content

The benchmark test for load operations cannot finish #82

@llxisdsh

Description

@llxisdsh

Describe the bug
The benchmark test cannot complete, and fmt.Println(111) fails to print any output. The test appears to hang indefinitely.

To Reproduce

Run the test function:

const countLoad = 1000000
func BenchmarkLoad_cornelk_hashmap(b *testing.B) {
	b.ReportAllocs()
	var m = hashmap.New[int, int]()
	for i := 0; i < countLoad; i++ {
		m.Set(i, i)
	}
	fmt.Println(111)
	runtime.GC()
	b.ResetTimer()
	b.RunParallel(func(pb *testing.PB) {
		i := 0
		for pb.Next() {
			_, _ = m.Get(i)
			i++
			if i >= countLoad {
				i = 0
			}
		}
	})
}

Expected behavior
The benchmark should complete execution
"111" should print to console before the test runs
Proper parallel read operations should occur

System (please complete the following information):

  • OS: Windows
  • Version / Commit: v1.0.8
  • cpu: AMD Ryzen Threadripper 3970X 32-Core Processor

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions