This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"strings" | |
"testing" | |
) | |
var m = map[string]bool{"hello.goodbye": true} | |
func old(req string, filter map[string]bool) string { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkKetama8-4 5000000 373 ns/op | |
BenchmarkKetama32-4 5000000 394 ns/op | |
BenchmarkKetama128-4 3000000 433 ns/op | |
BenchmarkKetama512-4 3000000 538 ns/op | |
BenchmarkKetama2048-4 2000000 672 ns/op | |
BenchmarkKetama8192-4 2000000 978 ns/op | |
BenchmarkChash8-4 10000000 129 ns/op | |
BenchmarkChash32-4 10000000 136 ns/op | |
BenchmarkChash128-4 10000000 220 ns/op | |
BenchmarkChash512-4 5000000 318 ns/op |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dgryski@kamek[w] \ʕ◔ϖ◔ʔ/ > cat main.go | |
package main | |
import "log" | |
type X struct { | |
body string | |
} | |
type Message interface { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEXT main.main(SB) /home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/peachpy-examples/struct/main.go | |
main.go:11 0x401000 64488b0c25f8ffffff FS MOVQ FS:0xfffffff8, CX | |
main.go:11 0x401009 483b6110 CMPQ 0x10(CX), SP | |
main.go:11 0x40100d 0f86de000000 JBE 0x4010f1 | |
main.go:11 0x401013 4883ec60 SUBQ $0x60, SP | |
main.go:11 0x401017 48896c2458 MOVQ BP, 0x58(SP) | |
main.go:11 0x40101c 488d6c2458 LEAQ 0x58(SP), BP | |
main.go:12 0x401021 488d05585d0900 LEAQ 0x95d58(IP), AX | |
main.go:12 0x401028 48890424 MOVQ AX, 0(SP) | |
main.go:12 0x40102c e83fcb0000 CALL runtime.newobject(SB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"errors" | |
"flag" | |
"fmt" | |
"log" | |
"os" | |
"runtime" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from peachpy import * | |
from peachpy.x86_64 import * | |
r = Argument(ptr(const_uint64_t)) | |
bits = Argument(ptr(const_uint64_t)) | |
hashes = Argument(ptr(const_uint16_t)) | |
length = Argument(size_t) | |
with Function("querySSE", (r, bits, hashes, length), float_, target=uarch.default + isa.fma3) as function: | |
reg_r = GeneralPurposeRegister64() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# github.com/dgryski/w | |
"".BenchmarkBar t=1 size=35 args=0x8 locals=0x0 | |
0x0000 00000 (/home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/w/main_test.go:9) TEXT "".BenchmarkBar(SB), $0-8 | |
0x0000 00000 (/home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/w/main_test.go:9) NOP | |
0x0000 00000 (/home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/w/main_test.go:9) NOP | |
0x0000 00000 (/home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/w/main_test.go:9) FUNCDATA $0, gclocals·87d20ce1b58390b294df80b886db78bf(SB) | |
0x0000 00000 (/home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/w/main_test.go:9) FUNCDATA $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB) | |
0x0000 00000 (/home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/w/main_test.go:10) MOVQ "".b+8(FP), AX | |
0x0005 00005 (/home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/w/main_test.go:10) MOVQ $0, CX | |
0x0007 00007 (/home/dgryski/Dropbox/GITS/gocode/src/github.com/dgryski/w/main_test.go:10) MOVQ 184(AX), DX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a port of the FAST Java version of | |
// https://jackmott.github.io/programming/2016/09/01/performance-in-the-large.html | |
// Original Go translation of naive version from https://gist.github.com/magiconair/68a524fc847ba2860893a799f637f532 | |
// | |
// Code is not pretty!!! ;) | |
// | |
// | |
package main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name old time/op new time/op delta | |
Spooky8-4 43.4ns ± 2% 31.0ns ± 1% -28.58% (p=0.000 n=26+29) | |
Spooky16-4 69.3ns ± 1% 44.6ns ± 1% -35.68% (p=0.000 n=24+29) | |
Spooky40-4 85.6ns ± 0% 47.6ns ± 1% -44.42% (p=0.000 n=29+29) | |
Spooky64-4 126ns ± 0% 60ns ± 1% -52.11% (p=0.000 n=19+29) | |
Spooky1K-4 1.16µs ± 3% 0.39µs ± 1% -66.45% (p=0.000 n=26+27) | |
Spooky8K-4 8.05µs ± 2% 2.65µs ± 1% -67.08% (p=0.000 n=29+28) | |
Siphash8-4 23.6ns ± 0% 22.5ns ± 0% -4.70% (p=0.000 n=29+18) | |
Siphash16-4 27.6ns ± 2% 26.3ns ± 0% -4.52% (p=0.000 n=29+30) | |
Siphash40-4 40.1ns ± 1% 39.0ns ± 0% -2.65% (p=0.000 n=28+29) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// +build !appengine | |
package mpchash | |
import ( | |
"reflect" | |
"unsafe" | |
) | |
func stringToSlice(s string) []byte { |