Skip to content

Instantly share code, notes, and snippets.

View cstockton's full-sized avatar

Chris Stockton cstockton

View GitHub Profile
package deletetest
import (
"context"
"encoding/json"
"io"
"net"
"testing"
"time"
package deletetest
import (
"context"
"encoding/json"
"io"
"testing"
"time"
gobgpapi "github.com/osrg/gobgp/api"
.../github.com/pltr$ mkdir $GOPATH/src/github.com/pltr
.../github.com/pltr$ cd $GOPATH/src/github.com/pltr
.../github.com/pltr$ git clone git@github.com:pltr/onering.git
Cloning into 'onering'...
remote: Counting objects: 251, done.
remote: Compressing objects: 100% (155/155), done.
remote: Total 251 (delta 158), reused 186 (delta 94), pack-reused 0
Receiving objects: 100% (251/251), 40.88 KiB | 0 bytes/s, done.
Resolving deltas: 100% (158/158), done.
function _alias_wgo() {
W_PROG=$1
W_ARGS="${@:2}"
W_WATCH="${W_WATCH:-.}"
W_EXT="${W_EXT:-py|go|tpl|sh|md|txt}"
W_IGNORE="${W_IGNORE:-vendor,envs,log,.git}"
# look for go package
go list >/dev/null 2>&1 && {
W_PROG="go"
package cond
import (
"context"
"strconv"
"sync"
"sync/atomic"
"testing"
)
// +build go1.10
package strutil
type Builder -> strings.Builder
@cstockton
cstockton / benchmark_test.go
Created October 28, 2017 18:52
for reddit comment
// For reddit comment:
// https://www.reddit.com/r/golang/comments/799of8/how_to_implement_a_lock_free_array/dp0js4k/
//
// About: https://github.com/cornelk/hashmap
// Map of atomic Values built in 10 seconds without unsafe is the winner for a contentious but consistent key set:
//
// BenchmarkCorrectReadGoAtomicMapUintMutex-24 1000000 1957 ns/op 0 B/op 0 allocs/op
// BenchmarkCorrectReadGoAtomicMapUintValMutex-24 1000000 1926 ns/op 0 B/op 0 allocs/op
func BenchmarkCorrectReadGoAtomicMapUintMutex(b *testing.B) {
@cstockton
cstockton / all.diff
Created October 15, 2017 21:02
issue-22197
new file mode 100644
index 0000000..365941e
--- /dev/null
+++ b/src/cmd/compile/internal/ssa/chansendn.go
@@ -0,0 +1,282 @@
+package ssa
+
+import (
+ "bytes"
+ "cmd/compile/internal/types"
type Topic interface {
On(fn Func)
Emit(index int)
Wait()
}
type state struct {
id, idx int
}
BenchmarkSend/128-24 200000 5788 ns/op
BenchmarkSend/128#01-24 1000000 2053 ns/op
BenchmarkSend/256-24 100000 10465 ns/op
BenchmarkSend/256#01-24 500000 3311 ns/op
BenchmarkSend/512-24 100000 18025 ns/op
BenchmarkSend/512#01-24 200000 6123 ns/op
BenchmarkSend/1024-24 30000 36596 ns/op
BenchmarkSend/1024#01-24 100000 11584 ns/op
BenchmarkSend/2048-24 20000 64805 ns/op
BenchmarkSend/2048#01-24 50000 22978 ns/op