Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for cmpFunc (0.14 sec)

  1. src/slices/sort_benchmark_test.go

    			}
    			midpoint := len(structs) / 2
    			needle := &myStruct{n: (structs[midpoint].n + structs[midpoint+1].n) / 2}
    			cmpFunc := func(a, b *myStruct) int { return a.n - b.n }
    			b.ResetTimer()
    			for i := 0; i < b.N; i++ {
    				slices.BinarySearchFunc(structs, needle, cmpFunc)
    			}
    		})
    	}
    }
    
    func BenchmarkSortFuncStruct(b *testing.B) {
    	for _, size := range []int{16, 32, 64, 128, 512, 1024} {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 04 23:39:07 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  2. src/sort/sort_slices_benchmark_test.go

    		ss := makeRandomStructs(N)
    		b.StartTimer()
    		Sort(ss)
    	}
    }
    
    func BenchmarkSortFuncStructs(b *testing.B) {
    	cmpFunc := func(a, b *myStruct) int { return a.n - b.n }
    	for i := 0; i < b.N; i++ {
    		b.StopTimer()
    		ss := makeRandomStructs(N)
    		b.StartTimer()
    		slices.SortFunc(ss, cmpFunc)
    	}
    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/slices/slices_test.go

    func BenchmarkSort(b *testing.B) {
    	b.Run("SortFunc", func(b *testing.B) {
    		cmpFunc := func(a, b *myStruct) int { return a.n - b.n }
    		for i := 0; i < b.N; i++ {
    			b.StopTimer()
    			ss := makeRandomStructs(N)
    			b.StartTimer()
    			SortFunc(ss, cmpFunc)
    		}
    	})
    	b.Run("SortStableFunc", func(b *testing.B) {
    		cmpFunc := func(a, b *myStruct) int { return a.n - b.n }
    		for i := 0; i < b.N; i++ {
    			b.StopTimer()
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri May 10 23:33:56 UTC 2024
    - 18.2K bytes
    - Viewed (0)
  4. pkg/kubelet/eviction/helpers.go

    	}
    }
    
    // Cmp compares p1 and p2 and returns:
    //
    //	-1 if p1 <  p2
    //	 0 if p1 == p2
    //	+1 if p1 >  p2
    type cmpFunc func(p1, p2 *v1.Pod) int
    
    // multiSorter implements the Sort interface, sorting changes within.
    type multiSorter struct {
    	pods []*v1.Pod
    	cmp  []cmpFunc
    }
    
    // Sort sorts the argument slice according to the less functions passed to OrderedBy.
    func (ms *multiSorter) Sort(pods []*v1.Pod) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Nov 01 18:46:33 UTC 2023
    - 53.6K bytes
    - Viewed (0)
  5. pilot/pkg/leaderelection/leaderelection_test.go

    		next := LeaderElection{
    			remote:         nextHop.remote,
    			defaultWatcher: &fakeDefaultWatcher{defaultRevision: "default"},
    			revision:       nextHop.revision,
    		}
    		cmpFunc, key := start.GetComp()
    		if cmpFunc(key, &next) {
    			nc := append([]instance{}, chain...)
    			nc = append(nc, start)
    			checkCycles(t, nextHop, cases, nc)
    		}
    	}
    }
    
    func TestLeaderElectionConfigMapRemoved(t *testing.T) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Sun Apr 28 04:22:19 UTC 2024
    - 11.4K bytes
    - Viewed (0)
  6. src/sort/gen_sort_variants.go

    				},
    			},
    		},
    		Variant{
    			Name:       "generic_func",
    			Path:       "zsortanyfunc.go",
    			Package:    "slices",
    			FuncSuffix: "CmpFunc",
    			TypeParam:  "[E any]",
    			ExtraParam: ", cmp func(a, b E) int",
    			ExtraArg:   ", cmp",
    			DataType:   "[]E",
    			Funcs: template.FuncMap{
    				"Less": func(name, i, j string) string {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:27 UTC 2023
    - 19.6K bytes
    - Viewed (0)
Back to top