I hereby claim:
- I am localhots on github.
- I am localhots (https://keybase.io/localhots) on keybase.
- I have a public key ASCDKmJ4kwqvKdd3GxSPxccArJxaM3JzCVfx6_vQDTdd9wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| $ go test -bench=. | |
| goos: darwin | |
| goarch: amd64 | |
| pkg: github.com/localhots/playground/switch_vs_map | |
| BenchmarkSwitch-8 2000000000 0.34 ns/op | |
| BenchmarkSwitchMiss-8 2000000000 0.64 ns/op | |
| BenchmarkMap-8 300000000 4.11 ns/op | |
| BenchmarkMapMiss-8 200000000 8.18 ns/op | |
| PASS | |
| ok github.com/localhots/playground/switch_vs_map 6.219s |
I hereby claim:
To claim this, I am signing this object:
| PROJECTS=$HOME/Code | |
| function c { cd $(realpath $PROJECTS/$1); } | |
| function _c { __bash_directory_complete $PROJECTS; } | |
| complete -F _c c | |
| function __bash_directory_complete { | |
| local cur=${COMP_WORDS[COMP_CWORD]} | |
| COMPREPLY=($(compgen -o nospace -W "$(ls $1)" -- $cur)) | |
| } |
| func processWithBatches(items []uint32, batchSize int, f func(batch []uint32)) { | |
| if len(items) == 0 { | |
| return | |
| } | |
| if len(items) <= batchSize { | |
| f(items) | |
| } else { | |
| f(items[:batchSize]) | |
| processWithBatches(items[batchSize:], batchSize, f) |
| package main | |
| import ( | |
| "log" | |
| "runtime" | |
| "strings" | |
| ) | |
| const ( | |
| rootPath = "/path/to/project/root/" |
| package main | |
| import "time" | |
| // Uint32BatchWithTimeout is an implementation of a batch that starts processing | |
| // either if maximum size or timeout is reached. | |
| type Uint32BatchWithTimeout struct { | |
| size int | |
| timeout time.Duration | |
| fun func(batch []uint32) |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "time" | |
| as "github.com/aerospike/aerospike-client-go" | |
| ) |
| require 'bundler' | |
| Bundler.setup | |
| require 'unicorn' | |
| begin | |
| # Unicorn self-process killer | |
| require 'unicorn/worker_killer' | |
| # Max requests per worker |