par

package
v0.0.0-...-32346b2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map[T, O any, WorkerState any](
	iter iter.Seq[T],
	f func(T, *WorkerState) O,
) iter.Seq[O]

Runs the map function parallelized over the values in the input iterator. It does batching to reduce scheduler and channel overhead. Inspired by Rust's rayon's par_iter. It does not do dynamic chunk sizing (yet). You must completely consume the output iterator.

func MapOpt

func MapOpt[T, O any, WorkerState any](
	opts MapOpts,
	iter iter.Seq[T],
	f func(T, *WorkerState) O,
) iter.Seq[O]

Runs the map function parallelized over the values in the input iterator. It does batching to reduce scheduler and channel overhead. Inspired by Rust's rayon's par_iter. It does not do dynamic chunk sizing (yet). You must completely consume the output iterator.

Types

type MapOpts

type MapOpts struct {
	// How many items to group up to submit to workers at a time.
	BatchSize int
	// Just feed the input directly into the output, no workers.
	Sequential bool
}

Jump to

Keyboard shortcuts

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