github.com/haraldrudell/parl@v0.4.176/pruntime/code-location_bench_test.go (about)

     1  /*
     2  © 2023–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/)
     3  ISC License
     4  */
     5  
     6  package pruntime
     7  
     8  import (
     9  	"testing"
    10  )
    11  
    12  // PackFunc is 467.1 ns on 2021 M1 Max
    13  //   - 783 64-bit parallel atomic reads 0.5962 wall-ns/op
    14  //   - 0.69 Kimap reads 680.5 wall-ns/op
    15  //   - 0.40 parallel mutex Lock/Unlock 1,178 wall-ns/op
    16  //
    17  // 231123 c66
    18  // Running tool: /opt/homebrew/bin/go test -benchmem -run=^$ -bench ^BenchmarkPackFunc$ github.com/haraldrudell/parl/pruntime
    19  // goos: darwin
    20  // goarch: arm64
    21  // pkg: github.com/haraldrudell/parl/pruntime
    22  // BenchmarkPackFunc-10    	 2627085	       467.1 ns/op	     280 B/op	       3 allocs/op
    23  // PASS
    24  // ok  	github.com/haraldrudell/parl/pruntime	1.983s
    25  func BenchmarkPackFunc(b *testing.B) {
    26  	for i := 0; i < b.N; i++ {
    27  		NewCodeLocation(0).PackFunc()
    28  	}
    29  }