Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for BenchmarkCompareStringEqual (0.21 sec)

  1. src/runtime/string_test.go

    	"unicode/utf8"
    )
    
    // Strings and slices that don't escape and fit into tmpBuf are stack allocated,
    // which defeats using AllocsPerRun to test other optimizations.
    const sizeNoStack = 100
    
    func BenchmarkCompareStringEqual(b *testing.B) {
    	bytes := []byte("Hello Gophers!")
    	s1, s2 := string(bytes), string(bytes)
    	for i := 0; i < b.N; i++ {
    		if s1 != s2 {
    			b.Fatal("s1 != s2")
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 13 14:05:23 UTC 2022
    - 13.3K bytes
    - Viewed (0)
Back to top