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 ( | |
"flag" | |
"fmt" | |
"io/fs" | |
"io/ioutil" | |
"os" | |
"path/filepath" | |
"sort" |
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
.PHONY: help | |
# This is a code for automatic help generator. | |
# It supports ANSI colors and categories. | |
# To add new item into help output, simply add comments | |
# starting with '##'. To add category, use @category. | |
GREEN := $(shell tput -Txterm setaf 2) | |
WHITE := $(shell tput -Txterm setaf 7) | |
YELLOW := $(shell tput -Txterm setaf 3) | |
RESET := $(shell tput -Txterm sgr0) |
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
$ go test -test.bench . | |
BenchmarkLoop-4 10000 146857 ns/op | |
BenchmarkLoopSorted-4 100000 19901 ns/op | |
PASS | |
ok test/branch 3.706s |
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
// Run PostgreSQL server: | |
// docker run -e POSTGRES_PASSWORD="" -p 5432:5432 postgres | |
// Monitor running processes: | |
// watch -n 1 'echo "select pid,query_start,state,query from pg_stat_activity;" | psql -h localhost -U postgres | |
// | |
// For all handlers, call to db takes 5 seconds, | |
// | |
// Three endpoints: | |
// - "/" - take 5 seconds | |
// - "/ctx" - take 1 seconds, due to 1 second cancellation policy |
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
### Keybase proof | |
I hereby claim: | |
* I am divan on github. | |
* I am ivandaniluk (https://keybase.io/ivandaniluk) on keybase. | |
* I have a public key ASApyXdCqP1m8QKvieOB9yRosaGKzbIGhZQk86dFd_b8qgo | |
To claim this, I am signing this object: |
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 funcptr | |
import "testing" | |
type LargeStruct struct { | |
f1, f2, f3, f4, f5, f6, f7, f8, f9, f10 uint64 | |
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10 uint64 | |
b1, b2, b3, b4, b5, b6, b7, b8, b9, b10 uint64 | |
c1, c2, c3, c4, c5, c6, c7, c8, c9, c10 uint64 | |
d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 uint64 |