timings

package
v1.44.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttrSlice

func AttrSlice[T any](v []T) int

AttrSlice returns the optimal number of slices based on the input slice length and the number of CPU cores available.

func ParallelForEach added in v1.44.0

func ParallelForEach[T any](slice []T, numThreads int, fn func(index int, value T))

ParallelForEach executes a provided function concurrently on each element of a slice using multiple goroutines. The number of goroutines is determined by the numThreads parameter. If the slice is empty or numThreads is less than or equal to zero, the function returns immediately. The fn parameter is a function that takes the index and value of an element in the slice as arguments.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL