Documentation ¶
Index ¶
- Variables
- func AsyncBenchmarkFile(resultChannel chan Result, wg *sync.WaitGroup, compressionEngines []string, ...)
- func BenchmarkSuite(files []string, algorithms [][]string, generateHTML bool) string
- func ByteCountSI(b int64) string
- func CompressFile(compressionEngine string, fileString string)
- func DecompressFile(compressionEngine string, fileString string) []byte
- type CompressedFile
- type Result
- type Settings
Constants ¶
This section is empty.
Variables ¶
var Engines = [...]string{"all", "suite", "lzss", "dmc", "huffman", "mcc", "flate", "gzip", "lzw", "zlib", "arithmetic"}
Engines is a slice of strings representing possible algorithms.
var Readers = map[string]interface{}{ "lzss": lz.NewReader, "dmc": dmc.NewReader, "mcc": mcc.NewReader, "huffman": huffman.NewReader, "arithmetic": arithmetic.NewReader, "zlib": zlib.NewReader, "flate": flate.NewReader, "gzip": gzip.NewReader, "lzw": lzw.NewReader, }
Readers represents a map of algorithm names to their NewReader interfaces.
var Suites = map[string][]string{"all": Engines[2:], "suite": {"lzss", "dmc", "huffman", "mcc", "flate", "gzip", "lzw", "zlib", "arithmetic"}}
Suites is a map of strings to strings representing a suite name and the contained algorithms.
var Writers = map[string]interface{}{ "lzss": lz.NewWriter, "dmc": dmc.NewWriter, "mcc": mcc.NewWriter, "huffman": huffman.NewWriter, "arithmetic": arithmetic.NewWriter, "zlib": zlib.NewWriter, "flate": flate.NewWriter, "gzip": gzip.NewWriter, "lzw": lzw.NewWriter, }
Writers represents a map of algorithm names to their NewWriter interfaces.
Functions ¶
func AsyncBenchmarkFile ¶
func AsyncBenchmarkFile(resultChannel chan Result, wg *sync.WaitGroup, compressionEngines []string, fileString string)
AsyncBenchmarkFile takes a channel to push the result, a waitgroup, engines, a file string and runs the benchmark. The function will push the result to the channel or push a failed result if it is able to catch an error during execution.
func BenchmarkSuite ¶
BenchmarkSuite takes a set of files and algorithms and returns the result as an html table if generateHTML is set. The result is also outputted to stdout.
func ByteCountSI ¶
ByteCountSI takes the number of bytes as an int64 and returns a human readable string in the largest significant units possible.
func CompressFile ¶
CompressFile takes a compression algorithm as a string and a path to a file and writes out the file in the same path with .compressed appended to the end.
func DecompressFile ¶
DecompressFile takes a compression algorithm as a string and a path to a file and writes out the decompressed file in the same path with .decompressed appended to the end.
Types ¶
type CompressedFile ¶
type CompressedFile struct { CompressionEngine string Compressed []byte Decompressed []byte MaxSearchBufferLength int // contains filtered or unexported fields }
CompressedFile is a struct used to read a compressed file or write to a compressed file.
func GetCompressedFileFromPath ¶
func GetCompressedFileFromPath(path string) (CompressedFile, error)
GetCompressedFileFromPath takes a path variable and returns a CompressedFile object or an error.
type Result ¶
type Result struct { CompressionEngine string TimeTaken string Ratio float32 ActualEntropy float32 Entropy float64 Lossless bool Failed bool }
Result is an intermediary object used to represent the benchmarked results of a certain file and algorithm.
type Settings ¶
Settings represents an object that can be used to modify the settings when benchmarking files with BenchmarkFile
func NewSuiteSettings ¶
func NewSuiteSettings() Settings
NewSuiteSettings returns common settings for a testing suite as a Settings object