Skip to content

Instantly share code, notes, and snippets.

View derekcollison's full-sized avatar

Derek Collison derekcollison

View GitHub Profile
benchmark old ns/op new ns/op delta
Benchmark___PubNo_Payload 205 203 -0.98%
Benchmark___Pub8b_Payload 256 205 -19.92%
Benchmark__Pub32b_Payload 339 232 -31.56%
Benchmark_Pub256B_Payload 1082 319 -70.52%
Benchmark___Pub1K_Payload 4026 846 -78.99%
Benchmark___Pub4K_Payload 16623 5978 -64.04%
Benchmark___Pub8K_Payload 38252 19850 -48.11%
Benchmark__________PubSub 476 433 -9.03%
Benchmark__PubSubTwoConns 431 428 -0.70%
@derekcollison
derekcollison / keybase.md
Last active August 29, 2015 14:17
keybase.io

Keybase proof

I hereby claim:

  • I am derekcollison on github.
  • I am derekcollison (https://keybase.io/derekcollison) on keybase.
  • I have a public key whose fingerprint is E20F 8432 C2ED 2407 82BC 7BCE 0688 7D71 4F24 9E24

To claim this, I am signing this object:

Verifying myself: My Bitcoin username is +derekcollison. https://onename.io/derekcollison
@derekcollison
derekcollison / gnatsd performance
Created August 24, 2013 16:11
Gnatsd is clustered and getting a bit faster. Still more work to do. But nearly 5M msgs/sec not too bad..
ubuntu vm on MBA 11" 2013
ubuntu@apcera-raring-amd64:~/go/src/github.com/apcera/gnatsd/test$ go test --run="zzz" --bench="."
PASS
Benchmark___PubNo_Payload 10000000 209 ns/op 52.59 MB/s
Benchmark___Pub8b_Payload 10000000 293 ns/op 95.40 MB/s
Benchmark__Pub32b_Payload 5000000 433 ns/op 175.36 MB/s
Benchmark_Pub256B_Payload 1000000 1942 ns/op 270.28 MB/s
Benchmark___Pub1K_Payload 200000 8971 ns/op 229.84 MB/s
@derekcollison
derekcollison / gist:5685672
Last active December 17, 2015 22:59
Go 1.1 Map performance.
Impressed with the performance gains in go 1.1 on maps. I had to write my own for the original gnatsd.
HashMap is my own implementation.
go 1.0.3
~/Development/go/src/github.com/apcera/gnatsd/hashmap> go test --bench="."
PASS
Benchmark_GoMap___GetSmallKey 50000000 53.1 ns/op 18.82 MB/s
Benchmark_HashMap_GetSmallKey 10000000 21.4 ns/op 46.69 MB/s
Benchmark_GoMap____GetMedKey 20000000 107 ns/op 9.27 MB/s
Benchmark_HashMap__GetMedKey 50000000 34.7 ns/op 28.78 MB/s
@derekcollison
derekcollison / gist:4227635
Created December 6, 2012 19:40
Early results from high-performance NATS server
I have some early benchmark results for our work on a high performance NATS server in Go.

Quick Summary:
We can process ~2M msgs/sec through the system, and the ingress and egress are fairly well balanced.

The basics of the architecture are intelligent buffering and IO calls, fast hashing algorithms and subject distributor/routing, and a zero-allocation hand-written protocol parser.

In addition, I used quite a bit of inlining to avoid function overhead, no use of defer, and little to no object allocation within the fast path. I will share more details and the code at a future date.
@derekcollison
derekcollison / GoHash
Created October 29, 2012 22:32
Fast Hash Algorithms in Go
I have done some more work on creating very fast hash algorithms in Go for small (3-8) and medium (16-32) size keys. Below are the current results.
NOTE: I used SetBytes(1) to give quick estimate of ops/sec
2012 MacbookAir 11" i7 2Ghz
================
OSX - Mountain Lion
Go version go1.0.3
================
@derekcollison
derekcollison / FastGoHash
Created October 21, 2012 17:40
Fast Hash and HashMap in Go
I have really come to enjoy working in Go. From time to time I expect that the team at Apcera will
need to dip back into C for some things, but I decided to try to push the envelope with Go on making
some faster HashMaps than Go's builtin map. I started with the hash algorithms.
These are some results from my MBA11" core i7.. The fastest Hash algorithms will not work on machines
without support for unaligned access, and I still need to do some cleaning up before we OSS, but so far so good.
I aslo need to implement the fastest one, FNV1A_Hash_Yorikke, from http://http://www.sanmayce.com/Fastest_Hash
I hack SetBytes(1) to get a rough idea of ops/sec, its not actually IO.. So 10 MB/s is 10 Million ops per sec.
@derekcollison
derekcollison / vmc_token
Created March 23, 2012 21:02
Some fun history executing `more .vmc_token`
{
"http://api.cloudfoundry.qa.mozycloud.com/":"token-xxx",
"http://api.staging-cloudfoundry.com":"token-xxx",
"https://api.cloudfoundry.com":"token-xxx",
"http://api.derek.cloudfoundry.me":"token-xxx",
"http://api.vcloudlabs.com":"token-xxx",
"http://api.appcloud07.dev.mozycloud.com":"token-xxx",
"http://api.cloudfoundry.com":"token-xxx",
"http://cc.alpha.vmforce.com":"token-xxx",
"https://api.vcloudlabs.com":"token-xxx",
#!/usr/bin/tclsh8.5
#
# Usage: unmerged branch1 branch2
proc getlog branch {
lrange [split [exec git log $branch --oneline] "\n"] 0 100
}
proc diff {title c1 c2} {
puts "\n$title"