Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for BenchmarkLiteral (0.52 sec)

  1. src/regexp/all_test.go

    			b.Fatalf("FindStringSubmatch(%q)[0] = %q; want %q", s, subs[0], wantSubs)
    		}
    		if subs[1] != "aab" {
    			b.Fatalf("FindStringSubmatch(%q)[1] = %q; want %q", s, subs[1], "aab")
    		}
    	}
    }
    
    func BenchmarkLiteral(b *testing.B) {
    	x := strings.Repeat("x", 50) + "y"
    	b.StopTimer()
    	re := MustCompile("y")
    	b.StartTimer()
    	for i := 0; i < b.N; i++ {
    		if !re.MatchString(x) {
    			b.Fatalf("no match!")
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:36:03 UTC 2024
    - 25.8K bytes
    - Viewed (0)
Back to top