Documentation
¶
Overview ¶
Package compress provides hardware compression ability (IAA).
Example ¶
package main import ( "bytes" "crypto/rand" "io" "log" "github.com/intel/ixl-go/compress" ) func main() { input := make([]byte, 1024) _, _ = rand.Read(input) var w io.WriteCloser d, err := compress.NewDeflate(bytes.NewBuffer(nil)) if err != nil { // IAA devices not found log.Fatalln(err) } w = compress.NewWriter(d) _, _ = w.Write(input) _ = w.Close() }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BufWriter ¶
type BufWriter struct {
// contains filtered or unexported fields
}
BufWriter is a buffer writer for wrapping Deflate/Gzip as a io.Writer.
func NewDeflateWriter ¶
NewDeflateWriter create a deflate writer
func NewGzipWriter ¶
NewGzipWriter create a gzip writer
func NewWriter ¶
func NewWriter(bw blockWriter) *BufWriter
NewWriter create a new BufWriter. The argument should be Gzip or Deflate.
type Deflate ¶
type Deflate struct {
// contains filtered or unexported fields
}
Deflate takes data written to it and writes the deflate compressed form of that data to an underlying writer (see NewDeflate).
Notice:
- the history buffer used by hardware is 4KB.
- the `Deflate` object should be reused as much as possible to reduce the GC overhead.
func NewDeflate ¶
NewDeflate returns a new Deflate writing compressed data to underlying writer `w`.
type Gzip ¶
type Gzip struct { Header UTF8 bool // can be used with gzip command // contains filtered or unexported fields }
Gzip is an object to hold the state for compress data using gzip format.
type Inflate ¶
type Inflate struct {
// contains filtered or unexported fields
}
Inflate reads data from reader r and decompresses them.
Notice: the compressed data must be compressed by IAA or the whole stream must not larger than 4KB. This because the standard deflate's history buffer size is 32KB, but the IAA deflate's history buffer size is 4KB.
func NewInflate ¶
NewInflate creates a new Inflate with 4KB buffer size to decompress data from reader r.
func NewInflateWithBufferSize ¶
NewInflateWithBufferSize creates a new Inflate with specified buffer size to decompress data from reader r.
func (*Inflate) DecompressAll ¶
DecompressAll decompress all compressed data and write result into raw. The caller should make sure that `raw` has enough space.
type Option ¶
type Option func(opt *option)
Option type is used to configure how the library handles your compression or decompression.
func BusyPoll ¶
func BusyPoll() Option
BusyPoll enable busy-poll mode to reduce the deflate latency. Beware it may cause more CPU cost.
func HuffmanOnly ¶
func HuffmanOnly() Option
HuffmanOnly enable huffman code only mode to compress the data.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
internal
|
|
codelencode
Package codelencode provides a function to prepare the code len code.
|
Package codelencode provides a function to prepare the code len code. |
codelencode/avx2
Package avx2 provides avx2 version PrepareForCodeLenCode
|
Package avx2 provides avx2 version PrepareForCodeLenCode |
codelencode/avx512
Package avx512 provides avx512 version PrepareForCodeLenCode
|
Package avx512 provides avx512 version PrepareForCodeLenCode |
codelencode/sse2
Package sse2 provides sse2 version PrepareForCodeLenCode
|
Package sse2 provides sse2 version PrepareForCodeLenCode |
huffman
Package huffman provices some implementations of different algorithms for generating Huffman trees.
|
Package huffman provices some implementations of different algorithms for generating Huffman trees. |