Skip to content

Instantly share code, notes, and snippets.

package main
import (
"encoding/json"
"errors"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
$ ./bench.test -test.bench=. -test.benchtime=5s -test.cpuprofile=/tmp/cpu.pprof 
testing: warning: no tests to run
PASS
BenchmarkMap-4      	500000000	        15.9 ns/op
--- BENCH: BenchmarkMap-4
	main_test.go:37: result: 100.000000
	main_test.go:37: result: 10000.000000
	main_test.go:37: result: 1000000.000000
	main_test.go:37: result: 100000000.000000
@benbjohnson
benbjohnson / time_test.go
Created April 7, 2015 15:54
Time Generation
$ go test -bench=BenchmarkGenerateTimes
BenchmarkGenerateTimes 5000 261860 ns/op 212992 B/op 1 allocs/op
@benbjohnson
benbjohnson / bench.txt
Created November 20, 2014 03:40
Append, Append+Cap, Direct Index Benchmark
1 10 100 1000
---------------------------
Append | 88ns | 63ns | 23ns | 14ns |
Append+Cap | 88ns | 16ns | 10ns | 8ns |
Index | 84ns | 14ns | 7ns | 6ns |
@benbjohnson
benbjohnson / less.txt
Created November 13, 2014 01:32
LESS Notes
IDENT = [a-z0-9_#@.&:*\[\]=""]
COMMENT = /* ... */
COMMENT = // …
VARIABLE = @{...}
GT
COMMA
SEMICOLON
interpret vars in vars = @@
@benbjohnson
benbjohnson / index.html
Last active August 29, 2015 14:06
Hello to Embed.ly
<html>
<body>
<p>Hello Embed.ly folks!</p>
<p>This is an example of a gist hosted by Gist Exposed!</p>
<p>Here's the <a href="https://gist.github.com/benbjohnson/ac58ab0a61cf49955790">original gist on GitHub</a></p>
<p>Here's a link to the GitHub project: <a href="https://github.com/benbjohnson/gist">Gist Exposed!</a></p>
</body>
@benbjohnson
benbjohnson / raft_test.go
Created August 29, 2014 20:32
raft benchmark
... append to the end of raft_test.go ...
func BenchmarkRaftTripleNode(b *testing.B) {
b.ReportAllocs()
// Make the cluster
c := MakeCluster(3, b, nil)
defer c.Close()
// Should be one leader
@benbjohnson
benbjohnson / index.html
Last active August 29, 2015 14:05
Gist Exposed! Test
<html>
<head>
<script src="test.js"></script>
</head>
<body>
<p>Testing</p>
<p>1...2...3...</p>
</body>
</html>
@benbjohnson
benbjohnson / rnd.txt
Last active August 29, 2015 14:04
bolt bench
$ bolt bench --batch-size 1 --count 10000 --write-mode rnd
# Write 4.102113174s (410.211us/op) (2437 op/sec)
$ bolt bench --batch-size 10 --count 100000 --write-mode rnd
# Write 12.084931999s (120.849us/op) (8274 op/sec)
$ bolt bench --batch-size 100 --count 100000 --write-mode rnd
# Write 5.436509914s (54.365us/op) (18394 op/sec)
$ bolt bench --batch-size 1000 --count 100000 --write-mode rnd
@benbjohnson
benbjohnson / cpu.svg
Created August 6, 2014 14:45
ledisdb+bolt cpu pprof w/o NoSync
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.