Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 94 for stopTimer (0.27 sec)

  1. src/sort/sort_test.go

    		Stable(StringSlice(data))
    		b.StopTimer()
    	}
    }
    
    func BenchmarkSortInt1K(b *testing.B) {
    	b.StopTimer()
    	for i := 0; i < b.N; i++ {
    		data := make([]int, 1<<10)
    		for i := 0; i < len(data); i++ {
    			data[i] = i ^ 0x2cc
    		}
    		b.StartTimer()
    		Ints(data)
    		b.StopTimer()
    	}
    }
    
    func BenchmarkSortInt1K_Sorted(b *testing.B) {
    	b.StopTimer()
    	for i := 0; i < b.N; i++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 07 19:41:04 UTC 2024
    - 16.9K bytes
    - Viewed (0)
  2. src/sort/sort_slices_benchmark_test.go

    	return x
    }
    
    const N = 100_000
    
    func BenchmarkSortInts(b *testing.B) {
    	for i := 0; i < b.N; i++ {
    		b.StopTimer()
    		ints := makeRandomInts(N)
    		b.StartTimer()
    		Sort(IntSlice(ints))
    	}
    }
    
    func BenchmarkSlicesSortInts(b *testing.B) {
    	for i := 0; i < b.N; i++ {
    		b.StopTimer()
    		ints := makeRandomInts(N)
    		b.StartTimer()
    		slices.Sort(ints)
    	}
    }
    
    func BenchmarkSortIsSorted(b *testing.B) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 08 22:59:40 UTC 2024
    - 4K bytes
    - Viewed (0)
  3. pkg/api/testing/serialization_proto_test.go

    			b.Fatal(err)
    		}
    	}
    	b.StopTimer()
    }
    
    func BenchmarkEncodeProtobufGeneratedMarshal(b *testing.B) {
    	items := benchmarkItems(b)
    	width := len(items)
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		if _, err := items[i%width].Marshal(); err != nil {
    			b.Fatal(err)
    		}
    	}
    	b.StopTimer()
    }
    
    func BenchmarkEncodeProtobufGeneratedMarshalList10(b *testing.B) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat Jun 25 16:23:43 UTC 2022
    - 7.1K bytes
    - Viewed (0)
  4. src/regexp/all_test.go

    }
    
    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!")
    		}
    	}
    }
    
    func BenchmarkNotLiteral(b *testing.B) {
    	x := strings.Repeat("x", 50) + "y"
    	b.StopTimer()
    	re := MustCompile(".y")
    	b.StartTimer()
    	for i := 0; i < b.N; i++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 25 19:36:03 UTC 2024
    - 25.8K bytes
    - Viewed (0)
  5. cmd/url_test.go

    	if err := req.ParseForm(); err != nil {
    		b.Fatal(err)
    	}
    
    	b.RunParallel(func(pb *testing.PB) {
    		for pb.Next() {
    			req.Form.Get("uploadId")
    		}
    	})
    
    	// Benchmark ends here. Stop timer.
    	b.StopTimer()
    }
    
    // BenchmarkURLQuery - benchmark URL memory allocations
    func BenchmarkURLQuery(b *testing.B) {
    	req, err := http.NewRequest(http.MethodGet, "http://localhost:9000/bucket/name?uploadId=upload&partNumber=1", http.NoBody)
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue Nov 16 17:28:29 UTC 2021
    - 2K bytes
    - Viewed (0)
  6. src/encoding/json/bench_test.go

    				break
    			}
    		}
    		panic("re-marshal code.json: different result")
    	}
    }
    
    func BenchmarkCodeEncoder(b *testing.B) {
    	b.ReportAllocs()
    	if codeJSON == nil {
    		b.StopTimer()
    		codeInit()
    		b.StartTimer()
    	}
    	b.RunParallel(func(pb *testing.PB) {
    		enc := NewEncoder(io.Discard)
    		for pb.Next() {
    			if err := enc.Encode(&codeStruct); err != nil {
    				b.Fatalf("Encode error: %v", err)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 15:00:17 UTC 2024
    - 12.5K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/metrics/timing_ratio_histogram_test.go

    			return 0, errors.New("dto.Histogram has nil SampleCount")
    		}
    		return int64(*hist.SampleCount), nil
    	}
    	return 0, errMetricNotFound
    }
    
    func BenchmarkTimingRatioHistogram(b *testing.B) {
    	b.StopTimer()
    	now := time.Now()
    	clk := testclock.NewFakePassiveClock(now)
    	th := NewTestableTimingRatioHistogram(clk.Now,
    		&TimingRatioHistogramOpts{
    			compbasemetrics.TimingHistogramOpts{
    				Namespace: "testns",
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jul 13 16:03:06 UTC 2022
    - 8.7K bytes
    - Viewed (0)
  8. pkg/api/testing/serialization_test.go

    	width := len(items)
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		if _, err := runtime.Encode(legacyscheme.Codecs.LegacyCodec(v1.SchemeGroupVersion), &items[i%width]); err != nil {
    			b.Fatal(err)
    		}
    	}
    	b.StopTimer()
    }
    
    // BenchmarkEncodeCodecFromInternal measures the cost of performing a codec encode,
    // including conversions.
    func BenchmarkEncodeCodecFromInternal(b *testing.B) {
    	items := benchmarkItems(b)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Sep 25 11:04:08 UTC 2023
    - 19.3K bytes
    - Viewed (0)
  9. src/go/doc/testdata/benchmark.go

    // before a benchmark starts, but it can also used to resume timing after
    // a call to StopTimer.
    func (b *B) StartTimer() {
    	if !b.timerOn {
    		b.start = time.Now()
    		b.timerOn = true
    	}
    }
    
    // StopTimer stops timing a test. This can be used to pause the timer
    // while performing complex initialization that you don't
    // want to measure.
    func (b *B) StopTimer() {
    	if b.timerOn {
    		b.duration += time.Since(b.start)
    		b.timerOn = false
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Oct 02 02:28:27 UTC 2022
    - 7.4K bytes
    - Viewed (0)
  10. src/encoding/binary/binary_test.go

    		buf.Reset()
    		Write(w, BigEndian, slice)
    	}
    	b.StopTimer()
    }
    
    func BenchmarkAppendSlice1000Structs(b *testing.B) {
    	slice := make([]Struct, 1000)
    	buf := make([]byte, 0, Size(slice))
    	b.SetBytes(int64(cap(buf)))
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		Append(buf, BigEndian, slice)
    	}
    	b.StopTimer()
    }
    
    func BenchmarkReadSlice1000Structs(b *testing.B) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 19:16:18 UTC 2024
    - 25.4K bytes
    - Viewed (0)
Back to top