Documentation ¶
Index ¶
- Variables
- func AsyncBenchmarkFile(resultChannel chan Result, wg *sync.WaitGroup, compressionEngines []string, ...)
- func ByteCountSI(b int64) string
- func CompressFile(algorithms []string, path string, output string) []byte
- func CompressFiles(algorithms []string, files []string, extension string)
- func DecompressFile(algorithms []string, path string, output string) []byte
- func DecompressFiles(algorithms []string, files []string, extension string)
- 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 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 set of compression algorithms 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 CompressFiles ¶
CompressFiles takes a set of compression algorithms as a string and multiple file paths as a slice and writes out the files in the same path with the extension appended.
func DecompressFile ¶
DecompressFile takes a set of compression algorithms 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.
func DecompressFiles ¶
DecompressFiles takes a set of compression algorithms as a string and and multiple file paths as a slice and writes out the decompressed files 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.
func BenchmarkFile ¶
BenchmarkFile takes a set of algorithms, a file path, and a settings object. It benchmarks the file and returns the result as a Result object.
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