Documentation
¶
Index ¶
- Constants
- func DiffTimeStamps(t_earlier, t_later TimeStamp) int64
- func FloatsEqualWithTolerance(f1, f2, tolerancePercentage float64) bool
- func GetSampleTimePrecision() int64
- func Median(data []float64) float64
- func QuickMedian(xs []float64) float64
- func Statistics(data []float64) (mean, variance, stddev float64)
- type DPRNG
- type RTcomparisonResult
- type TimeStamp
Constants ¶
const MinimumDataPoints uint64 = 11
Variables ¶
This section is empty.
Functions ¶
func DiffTimeStamps ¶
Retruns the difference between two timestams in nanoseconds with the highest possible precision (which might be more than just one nanosecond). The function assumes that t_later is later than t_earlier and will return a negative value if this is not the case. Please note that the call to this function does NOT have constant runtime on other systems but Windows.
func GetSampleTimePrecision ¶
func GetSampleTimePrecision() int64
Returns the precision of time measurements obtained via SampleTime() on the runtime system in nanoseconds. Should return 100ns on Windows systems, and typically between 20ns and 100ns on Linux and MacOS systems.
func QuickMedian ¶
quickMedian returns the median in expected O(n) time. In case of an odd number of elements, it returns the middle one. In case of an even number of elements, it returns the higher of the two middle ones. Note: This function modifies the input slice. To avoid this, pass a copy of the slice.
func Statistics ¶
Types ¶
type DPRNG ¶
DPRNG is a Deterministic Pseudo-Random Number Generator based on the xorshift* algorithm (see https://en.wikipedia.org/wiki/Xorshift#xorshift*). This randum number generator is deterministic in the sequence of numbers it generates. It has a period of 2^64-1, i.e. every single number occurs every 2^64-1 calls and has the same successor and the same predecessor. This randum number generator is deterministic its runtime (i.e. it has a constant runtime). This randum number generator is not cryptographically secure. This randum number generator is not thread-safe. This random number generator has a very small memory footprint (16 bytes). The initial state must not be zero.
func (*DPRNG) Float64 ¶
Float64 returns a pseudo-random float64 in the range [0.0, 1.0) like Go’s math/rand.Float64(). It has a deterministic (i.e. constant) runtime and a high probability to be inlined by the compiler. The generated float64 values are uniformly distributed in the range [0.0, 1.0) with the effective precision of 53 bits (IEEE 754 compliant).
type RTcomparisonResult ¶
func CompareRuntimes ¶
func CompareRuntimes(sampleA, sampleB []float64, relativeSpeedupsToTest []float64, precisionLevel uint64) (result []RTcomparisonResult, err error)
CompareRuntimes compares two samples of runtimes (in float64, e.g., milliseconds) and computes the confidence that sample A is faster than sample B by at least the specified relative speedups. The precisionLevel parameter controls the number of bootstrap repetitions (higher values yield more precise results of the statistical tests but take longer to compute). It returns a slice of RTcomparisonResult, each containing one of the given relative speedup and the corresponding confidence level calculated by the statistical test. If there are not enough data points in either sample, an error is returned.
type TimeStamp ¶
A relative TimeStamp with the highest possible precision on the current runtime system. The values aren't comparable between computer restarts or between computers. They are only comparable on the same computer between two calls to SampleTime() within the same runtime of a program.
func SampleTime ¶
func SampleTime() TimeStamp
SampleTime returns a timestamp with the highest possible precision on the current runtime system.