Help us shape the future of Go! Take the 2026 Go Developer Survey

performance

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlignedAlloc

func AlignedAlloc(size int, alignment int) []float64

AlignedAlloc allocates aligned memory for SIMD operations

func OptimizeDataLayout

func OptimizeDataLayout(data []float64, rows, cols int) []float64

OptimizeDataLayout optimizes data layout for cache efficiency

Types

type ChunkedProcessor

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

ChunkedProcessor processes data in chunks with parallel execution

func NewChunkedProcessor

func NewChunkedProcessor(chunkSize int, parallel bool) *ChunkedProcessor

NewChunkedProcessor creates a new chunked processor

func (*ChunkedProcessor) Process

func (c *ChunkedProcessor) Process(data io.Reader, fn func(chunk [][]float64) error) error

Process executes a function on data chunks

type CompressionType

type CompressionType int

CompressionType defines compression algorithms

const (
	NoCompression CompressionType = iota
	GzipCompression
	SnappyCompression
	LZ4Compression
)

type DataType

type DataType int

DataType represents the data type of elements

const (
	Float64 DataType = iota
	Float32
	Int64
	Int32
)

type GCOptimizer

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

GCOptimizer manages garbage collection for better performance

func NewGCOptimizer

func NewGCOptimizer(gcPercent int, maxPause time.Duration) *GCOptimizer

NewGCOptimizer creates a new GC optimizer

func (*GCOptimizer) ForceGC

func (g *GCOptimizer) ForceGC()

ForceGC forces a garbage collection if needed

func (*GCOptimizer) GetStats

func (g *GCOptimizer) GetStats() map[string]interface{}

GetStats returns GC optimization statistics

func (*GCOptimizer) Start

func (g *GCOptimizer) Start()

Start begins GC optimization

func (*GCOptimizer) Stop

func (g *GCOptimizer) Stop()

Stop stops GC optimization

type MatrixPool

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

MatrixPool provides object pooling for matrices to reduce GC pressure

func NewMatrixPool

func NewMatrixPool(maxSize int) *MatrixPool

NewMatrixPool creates a new matrix pool

func (*MatrixPool) Get

func (mp *MatrixPool) Get(rows, cols int) *PooledMatrix

Get retrieves a matrix from the pool

func (*MatrixPool) GetStats

func (mp *MatrixPool) GetStats() PoolStats

GetStats returns current pool statistics

func (*MatrixPool) Put

func (mp *MatrixPool) Put(m *PooledMatrix)

Put returns a matrix to the pool

type MemoryEfficientBatch

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

MemoryEfficientBatch processes data in memory-efficient batches

func NewMemoryEfficientBatch

func NewMemoryEfficientBatch(maxMemoryMB int64) *MemoryEfficientBatch

NewMemoryEfficientBatch creates a memory-efficient batch processor

func (*MemoryEfficientBatch) Allocate

func (m *MemoryEfficientBatch) Allocate(bytes int64) error

Allocate tracks memory allocation

func (*MemoryEfficientBatch) CanAllocate

func (m *MemoryEfficientBatch) CanAllocate(bytes int64) bool

CanAllocate checks if allocation is possible within memory limits

func (*MemoryEfficientBatch) Free

func (m *MemoryEfficientBatch) Free(bytes int64)

Free tracks memory deallocation

func (*MemoryEfficientBatch) GetUsage

func (m *MemoryEfficientBatch) GetUsage() (used, max int64)

GetUsage returns current memory usage

type MemoryMappedDataset

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

MemoryMappedDataset provides memory-mapped file access for large datasets

func NewMemoryMappedDataset

func NewMemoryMappedDataset(filename string, rows, cols int, dtype DataType) (*MemoryMappedDataset, error)

NewMemoryMappedDataset creates a new memory-mapped dataset

func (*MemoryMappedDataset) Close

func (m *MemoryMappedDataset) Close() error

Close unmaps and closes the dataset

func (*MemoryMappedDataset) GetChunk

func (m *MemoryMappedDataset) GetChunk(startRow, endRow int) (mat.Matrix, error)

GetChunk retrieves a chunk of data without loading entire dataset

func (*MemoryMappedDataset) IterateChunks

func (m *MemoryMappedDataset) IterateChunks(chunkSize int, fn func(chunk mat.Matrix, startRow int) error) error

IterateChunks provides iterator over dataset chunks

func (*MemoryMappedDataset) SetChunk

func (m *MemoryMappedDataset) SetChunk(startRow int, chunk mat.Matrix) error

SetChunk writes a chunk of data

type PoolStats

type PoolStats struct {
	TotalAllocated   int64
	TotalRecycled    int64
	CurrentInUse     int64
	PeakUsage        int64
	AverageReuseRate float64
}

PoolStats tracks pool performance metrics

type PooledMatrix

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

PooledMatrix is a matrix that can be returned to a pool

func (*PooledMatrix) At

func (m *PooledMatrix) At(i, j int) float64

At returns the value at (i, j)

func (*PooledMatrix) Dims

func (m *PooledMatrix) Dims() (int, int)

Dims returns the dimensions

func (*PooledMatrix) Release

func (m *PooledMatrix) Release()

Release returns the matrix to the pool

func (*PooledMatrix) Set

func (m *PooledMatrix) Set(i, j int, v float64)

Set sets the value at (i, j)

func (*PooledMatrix) ToMat

func (m *PooledMatrix) ToMat() mat.Matrix

ToMat converts to a gonum matrix

type StreamMetrics

type StreamMetrics struct {
	ProcessedSamples uint64
	ProcessedBytes   uint64
	Throughput       float64
	Latency          float64
	// contains filtered or unexported fields
}

StreamMetrics tracks streaming performance metrics

type StreamStage

type StreamStage interface {
	Process(in <-chan mat.Matrix) <-chan mat.Matrix
}

StreamStage represents a processing stage in the pipeline

type StreamingPipeline

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

StreamingPipeline provides efficient streaming data processing

func NewStreamingPipeline

func NewStreamingPipeline(bufferSize int) *StreamingPipeline

NewStreamingPipeline creates a new streaming pipeline

func (*StreamingPipeline) AddStage

func (s *StreamingPipeline) AddStage(stage StreamStage)

AddStage adds a processing stage to the pipeline

func (*StreamingPipeline) GetMetrics

func (s *StreamingPipeline) GetMetrics() StreamMetrics

GetMetrics returns current pipeline metrics

func (*StreamingPipeline) Run

func (s *StreamingPipeline) Run(input <-chan mat.Matrix) <-chan mat.Matrix

Run executes the streaming pipeline

type ZeroCopyMatrix

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

ZeroCopyMatrix provides zero-copy matrix operations

func NewZeroCopyMatrix

func NewZeroCopyMatrix(data []float64, rows, cols int) *ZeroCopyMatrix

NewZeroCopyMatrix creates a zero-copy matrix from existing data

func (*ZeroCopyMatrix) At

func (m *ZeroCopyMatrix) At(i, j int) float64

At returns the value at (i, j) with bounds checking

func (*ZeroCopyMatrix) Dims

func (m *ZeroCopyMatrix) Dims() (int, int)

Dims returns the dimensions

func (*ZeroCopyMatrix) Set

func (m *ZeroCopyMatrix) Set(i, j int, v float64)

Set sets the value at (i, j) with bounds checking

func (*ZeroCopyMatrix) Slice

func (m *ZeroCopyMatrix) Slice(i0, i1, j0, j1 int) *ZeroCopyMatrix

Slice creates a view of a submatrix without copying

Jump to

Keyboard shortcuts

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