concurrency

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DotProduct

func DotProduct(a, b []float32) float32

DotProduct 点积

func GetWorkerCount

func GetWorkerCount() int

GetWorkerCount 获取工作线程数

func ParallelSlice

func ParallelSlice[T any](input []T, process func(T, int))

ParallelSlice 并发处理切片

Types

type WorkerPool

type WorkerPool struct {
	// contains filtered or unexported fields
}

WorkerPool 工作池

func NewWorkerPool

func NewWorkerPool(workers int) *WorkerPool

NewWorkerPool 创建工作池

func (*WorkerPool) BatchDot

func (wp *WorkerPool) BatchDot(vectors [][]float32, query []float32) []float32

WorkerPool 批量点积(并行版本)

func (*WorkerPool) Close

func (wp *WorkerPool) Close()

Close 关闭工作池

func (*WorkerPool) Submit

func (wp *WorkerPool) Submit(task func())

Submit 提交任务

func (*WorkerPool) Wait

func (wp *WorkerPool) Wait()

Wait 等待所有任务完成

Jump to

Keyboard shortcuts

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