.../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.
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 deletetest | |
import ( | |
"context" | |
"encoding/json" | |
"io" | |
"net" | |
"testing" | |
"time" |
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 deletetest | |
import ( | |
"context" | |
"encoding/json" | |
"io" | |
"testing" | |
"time" | |
gobgpapi "github.com/osrg/gobgp/api" |
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
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" |
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 cond | |
import ( | |
"context" | |
"strconv" | |
"sync" | |
"sync/atomic" | |
"testing" | |
) |
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 go1.10 | |
package strutil | |
type Builder -> strings.Builder |
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
// 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) { |
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
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" |
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
type Topic interface { | |
On(fn Func) | |
Emit(index int) | |
Wait() | |
} | |
type state struct { | |
id, idx int | |
} |
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
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 |