I hereby claim:
- I am klauspost on github.
- I am klauspost (https://keybase.io/klauspost) on keybase.
- I have a public key ASD53DNo7kJeDE1yhLrl2x5X1So398SG0jwkzn5ozDA6xAo
To claim this, I am signing this object:
package main | |
import ( | |
"fmt" | |
"math/rand" | |
) | |
// This will show various cases where bounds checks can be eliminated by keeping track of | |
// minimum and maximum potential values of slices and variables as SSA. | |
func main() { |
package move | |
import "unsafe" | |
func memmove(to uintptr, from uintptr, n uintptr) | |
func MemMove(dst, src []byte) { | |
memmove(uintptr(unsafe.Pointer(&dst[0])), uintptr(unsafe.Pointer(&src[0])), uintptr(len(src))) | |
} |
//+build !appengine | |
package prefetch | |
func prefetchBS(b [][]byte) |
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"os" | |
) | |
func main() { |
PASS | |
BenchmarkShift-4 20000 69666 ns/op 940.71 MB/s | |
BenchmarkAnd-4 20000 66802 ns/op 981.04 MB/s | |
ok _/c_/Temp/shifttest 4.146s | |
PASS | |
BenchmarkShift-4 20000 68680 ns/op 954.21 MB/s | |
BenchmarkAnd-4 20000 67339 ns/op 973.21 MB/s | |
ok _/c_/Temp/shifttest 4.121s | |
PASS | |
BenchmarkShift-4 20000 68687 ns/op 954.12 MB/s |
//+build ignore | |
package main | |
// Adapted from : https://gist.github.com/arnehormann/65421048f56ac108f6b5 | |
import ( | |
"bufio" | |
"encoding/binary" | |
"flag" |
package bench | |
import ( | |
"bytes" | |
"compress/gzip" | |
ogzip "github.com/klauspost/compress/gzip" | |
"testing" | |
) | |
var bidReq = []byte(`{"id":"50215d10a41d474f77591bff601f6ade","imp":[{"id":"86df3bc6-7bd4-44d9-64e2-584a69790229","native":{"request":"{\"ver\":\"1.0\",\"plcmtcnt\":1,\"assets\":[{\"id\":1,\"data\":{\"type\":12}},{\"id\":2,\"required\":1,\"title\":{\"len\":50}},{\"id\":3,\"required\":1,\"img\":{\"type\":1,\"w\":80,\"h\":80}},{\"id\":4,\"required\":1,\"img\":{\"type\":3,\"w\":1200,\"h\":627}},{\"id\":5,\"data\":{\"type\":3}},{\"id\":6,\"required\":1,\"data\":{\"type\":2,\"len\":100}}]}","ver":"1.0"},"tagid":"1","bidfloor":0.6,"bidfloorcur":"USD"}],"site":{"id":"1012864","domain":"www.abc.com","cat":["IAB3"],"mobile":1,"keywords":"apps,games,discovery,recommendation"},"device":{"dnt":1,"ua":"Mozilla/5.0 (Linux; U; Android 4.2.2; km-kh; SHV-E120S Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30","ip":"175.100.59.170","geo":{"lat":11.5625,"lon":104.916,"country":"KHM","r |
I hereby claim:
To claim this, I am signing this object:
# | |
# Finds the rounded down square root of 8 bit value value in 14. | |
# Uses self-modifying code to store result, so | |
# instruction 11 (LDI 0) and the two values (14, 15) needs to be reset between runs. | |
# | |
LDA 14 | |
SUB 15 | |
JPC 11 | |
STA 14 |
func BenchmarkCompressAllocations(b *testing.B) { | |
payload := []byte(strings.Repeat("Tiny payload", 20)) | |
for j := -2; j <= 9; j++ { | |
b.Run("level("+strconv.Itoa(j)+")", func(b *testing.B) { | |
b.Run("flate", func(b *testing.B) { | |
b.ReportAllocs() | |
for i := 0; i < b.N; i++ { | |
w, err := flate.NewWriter(ioutil.Discard, j) |