benchmarks

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Configuration constants
	BenchmarkMaxTimeout    = 150 * time.Second // detect resource timeout
	BenchmarkMaxTries      = 3                 // maximum number of attempts
	BenchmarkDetectTimeout = 30 * time.Second  // for select fast mirror
)

Variables

This section is empty.

Functions

func Benchmark

func Benchmark(ctx context.Context, base, query string, times int) (time.Duration, error)

Benchmark performs HTTP GET requests and measures response time

func GetTheFastestMirror

func GetTheFastestMirror(mirrors []string, testURL string) (string, error)

GetTheFastestMirror finds the fastest responding mirror from the provided list

Types

type Result

type Result struct {
	URL      string
	Duration time.Duration
}

Result stores benchmark results for a URL

type Results

type Results []Result

Results implements sort.Interface for []Result based on Duration

func (Results) Len

func (r Results) Len() int

func (Results) Less

func (r Results) Less(i, j int) bool

func (Results) Swap

func (r Results) Swap(i, j int)

Jump to

Keyboard shortcuts

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