Skip to content

Commit

Permalink
Merge pull request #186 from klauspost/s2-assembler-encode
Browse files Browse the repository at this point in the history
S2 amd64 assembly encoder
  • Loading branch information
klauspost committed Jan 28, 2020
2 parents e75fbf6 + 9aa0107 commit a8f0b11
Show file tree
Hide file tree
Showing 20 changed files with 26,395 additions and 343 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This package provides various compression algorithms.

# changelog

* Jan 28, 2020: Added [S2](https://github.com/klauspost/compress/tree/master/s2#s2-compression) AMD64 assembler and various optimizations. Stream speed >10GB/s. [#186](https://github.com/klauspost/compress/pull/186)
* Jan 20,2020 (v1.9.8) Optimize gzip/deflate with better size estimates and faster table generation. [#207](https://github.com/klauspost/compress/pull/207) by [luyu6056](https://github.com/luyu6056), [#206](https://github.com/klauspost/compress/pull/206).
* Jan 11, 2020: S2 Encode/Decode will use provided buffer if capacity is big enough. [#204](https://github.com/klauspost/compress/pull/204)
* Jan 5, 2020: (v1.9.7) Fix another zstd regression in v1.9.5 - v1.9.6 removed.
Expand Down
283 changes: 165 additions & 118 deletions s2/README.md

Large diffs are not rendered by default.

40 changes: 39 additions & 1 deletion s2/cmd/s2c/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
"runtime"
"runtime/pprof"
"runtime/trace"
"strconv"
"strings"
"sync"
Expand All @@ -32,11 +35,18 @@ var (
bench = flag.Int("bench", 0, "Run benchmark n times. No output will be written")
help = flag.Bool("help", false, "Display help")

cpuprofile, memprofile, traceprofile string

version = "(dev)"
date = "(unknown)"
)

func main() {
if false {
flag.StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to file")
flag.StringVar(&memprofile, "memprofile", "", "write mem profile to file")
flag.StringVar(&traceprofile, "traceprofile", "", "write trace profile to file")
}
flag.Parse()
sz, err := toSize(*blockSize)
exitErr(err)
Expand Down Expand Up @@ -85,6 +95,34 @@ Options:`)
}
files = append(files, found...)
}
if cpuprofile != "" {
f, err := os.Create(cpuprofile)
if err != nil {
log.Fatal(err)
}
pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}
if memprofile != "" {
f, err := os.Create(memprofile)
if err != nil {
log.Fatal(err)
}
defer f.Close()
defer pprof.WriteHeapProfile(f)
}
if traceprofile != "" {
f, err := os.Create(traceprofile)
if err != nil {
log.Fatal(err)
}
defer f.Close()
err = trace.Start(f)
if err != nil {
log.Fatal(err)
}
defer trace.Stop()
}

*quiet = *quiet || *stdout
allFiles := files
Expand All @@ -105,7 +143,7 @@ Options:`)
file, err := os.Open(filename)
exitErr(err)
defer closeOnce.Do(func() { file.Close() })
src, err := readahead.NewReaderSize(file, *cpu, int(sz))
src, err := readahead.NewReaderSize(file, *cpu, 1<<20)
exitErr(err)
defer src.Close()
finfo, err := file.Stat()
Expand Down
Loading

0 comments on commit a8f0b11

Please sign in to comment.