benchmark

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package benchmark provides tools for benchmarking template operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintBenchmarkResults

func PrintBenchmarkResults(results map[string]*BenchmarkResult)

PrintBenchmarkResults prints benchmark results in a human-readable format

func RunBenchmarkSuite

func RunBenchmarkSuite(ctx context.Context, manager types.TemplateManager, sources []types.TemplateSource, options map[string]interface{}) (map[string]*BenchmarkResult, error)

RunBenchmarkSuite runs a suite of benchmarks and returns the results

Types

type BenchmarkResult

type BenchmarkResult struct {
	// Name is the name of the benchmark
	Name string
	// Duration is the total duration of the benchmark
	Duration time.Duration
	// OperationCount is the number of operations performed
	OperationCount int
	// OperationsPerSecond is the number of operations per second
	OperationsPerSecond float64
	// AverageLatency is the average latency per operation
	AverageLatency time.Duration
	// MemoryUsage is the memory usage in bytes
	MemoryUsage int64
	// Errors is the number of errors encountered
	Errors int
	// Details contains additional details about the benchmark
	Details map[string]interface{}
}

BenchmarkResult contains the results of a benchmark

func TemplateExecuteBenchmark

func TemplateExecuteBenchmark(ctx context.Context, executor interfaces.TemplateExecutor, templates []*format.Template, options map[string]interface{}, iterations int) (*BenchmarkResult, error)

TemplateExecuteBenchmark benchmarks template execution

func TemplateLoadBenchmark

func TemplateLoadBenchmark(ctx context.Context, loader types.TemplateLoader, source string, sourceType string, iterations int) (*BenchmarkResult, error)

TemplateLoadBenchmark benchmarks template loading

Jump to

Keyboard shortcuts

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