Skip to content

Instantly share code, notes, and snippets.

View feyeleanor's full-sized avatar

Eleanor McHugh feyeleanor

View GitHub Profile
package main
import (
"fmt"
"os"
)
type request struct {
data []int
replyChannel chan []int
}
@feyeleanor
feyeleanor / gospeed on raspberrypi
Created July 13, 2012 13:32
first attempt to run the gospeed micro-benchmarks on a raspberrypi
root@raspberrypi:/usr/local/go/src/pkg/github.com/feyeleanor/gospeed# go test -test.bench=".*"
PASS
BenchmarkBaselineCastInt32ToInt 100000000 13.4 ns/op
BenchmarkBaselineCastIntToInt32 100000000 14.1 ns/op
BenchmarkBaselineCastInt64ToUint64 100000000 18.0 ns/op
BenchmarkBaselineCastUint64ToInt64 100000000 17.2 ns/op
BenchmarkBaselineVariableGet 100000000 14.2 ns/op
BenchmarkBaselineVariableSet 100000000 23.0 ns/op
BenchmarkBaselineVariableGetInterface 100000000 13.4 ns/op
BenchmarkBaselineVariableSetInterface 50000000 32.7 ns/op
@feyeleanor
feyeleanor / dnsruby-naptr-ordering.rb
Created August 14, 2012 15:47
Ordering NAPTR records with Dnsruby
require 'rubygems'
require 'dnsruby'
include Dnsruby
$nameserver = Resolver.new
def dig domain, rrtype
search = $nameserver.query(domain, Types.send(rrtype))
if rrtype == :NAPTR
search.answer.sort_by { |a| [ a.order, a.preference ] }.each { |rr|
@feyeleanor
feyeleanor / mbp2012 benchmarks
Created August 30, 2012 15:34
GoSpeed benchmarks on a 13" MBP mid-2012 with 16GB RAM and 2.5 GHz Intel Core i5
BenchmarkBaselineCastInt32ToInt 2000000000 0.33 ns/op
BenchmarkBaselineCastIntToInt32 2000000000 0.33 ns/op
BenchmarkBaselineCastInt64ToUint64 2000000000 0.33 ns/op
BenchmarkBaselineCastUint64ToInt64 2000000000 0.33 ns/op
BenchmarkBaselineVariableGet 2000000000 0.33 ns/op
BenchmarkBaselineVariableSet 2000000000 0.33 ns/op
BenchmarkBaselineVariableGetInterface 2000000000 0.33 ns/op
BenchmarkBaselineVariableSetInterface 100000000 34.6 ns/op
BenchmarkBaselineVariableIncrement 2000000000 1.98 ns/op
BenchmarkBaselineVariableDecrement 2000000000 1.98 ns/op
@feyeleanor
feyeleanor / gospeed with go 1.0.3
Created April 13, 2013 01:32
Run of http://github.com/feyeleanor/gospeed on 2012 Aluminium MacBook 2.5GHz Core i5 with 16GB RAM using Go 1.0.3.
bash-3.2# go test -test.bench="Benchmark" github.com/feyeleanor/gospeed
PASS
BenchmarkBaselineCastInt32ToInt 2000000000 0.34 ns/op
BenchmarkBaselineCastIntToInt32 2000000000 0.35 ns/op
BenchmarkBaselineCastInt64ToUint64 2000000000 0.34 ns/op
BenchmarkBaselineCastUint64ToInt64 2000000000 0.34 ns/op
BenchmarkBaselineVariableGet 2000000000 0.34 ns/op
BenchmarkBaselineVariableSet 2000000000 0.34 ns/op
BenchmarkBaselineVariableGetInterface 2000000000 0.34 ns/op
BenchmarkBaselineVariableSetInterface 100000000 10.4 ns/op
@feyeleanor
feyeleanor / gospeed with go 1.1beta2 revision d58997478ec6
Created April 13, 2013 22:49
Run of http://github.com/feyeleanor/gospeed on 2012 Aluminium MacBook 2.5GHz Core i5 with 16GB RAM using Go 1.1beta 2 revision d58997478ec6
bash-3.2# go test -test.bench="Benchmark" github.com/feyeleanor/gospeed
PASS
BenchmarkBaselineCastInt32ToInt 2000000000 0.37 ns/op
BenchmarkBaselineCastIntToInt32 2000000000 0.34 ns/op
BenchmarkBaselineCastInt64ToUint64 2000000000 0.34 ns/op
BenchmarkBaselineCastUint64ToInt64 2000000000 0.34 ns/op
BenchmarkBaselineVariableGet 2000000000 0.35 ns/op
BenchmarkBaselineVariableSet 2000000000 0.34 ns/op
BenchmarkBaselineVariableGetInterface 2000000000 0.34 ns/op
BenchmarkBaselineVariableSetInterface 2000000000 0.68 ns/op
@feyeleanor
feyeleanor / gospeed with go 1.1
Created May 17, 2013 19:08
Run of http://github.com/feyeleanor/gospeed on 2012 Aluminium MacBook 2.5GHz Core i5 with 16GB RAM using Go 1.1
eleanor$ go test -test.bench="Benchmark" github.com/feyeleanor/gospeed
PASS
BenchmarkBaselineCastInt32ToInt 2000000000 0.34 ns/op
BenchmarkBaselineCastIntToInt32 2000000000 0.35 ns/op
BenchmarkBaselineCastInt64ToUint64 2000000000 0.37 ns/op
BenchmarkBaselineCastUint64ToInt64 2000000000 0.34 ns/op
BenchmarkBaselineVariableGet 2000000000 0.34 ns/op
BenchmarkBaselineVariableSet 2000000000 0.35 ns/op
BenchmarkBaselineVariableGetInterface 2000000000 0.34 ns/op
BenchmarkBaselineVariableSetInterface 2000000000 0.69 ns/op
@feyeleanor
feyeleanor / go 1.1 performance compared to go 1.0.3
Created May 17, 2013 19:38
comparison of http://github.com/feyeleanor/gospeed results for go 1.0.3 and go 1.1 on 2012 Aluminium MacBook 2.5GHz Core i5 with 16GB RAM
benchmark old ns/op new ns/op delta
BenchmarkBaselineCastInt32ToInt 0 0 -0.00%
BenchmarkBaselineCastIntToInt32 0 0 +0.00%
BenchmarkBaselineCastInt64ToUint64 0 0 +8.82%
BenchmarkBaselineCastUint64ToInt64 0 0 -0.00%
BenchmarkBaselineVariableGet 0 0 -0.00%
BenchmarkBaselineVariableSet 0 0 +2.94%
BenchmarkBaselineVariableGetInterface 0 0 -0.00%
BenchmarkBaselineVariableSetInterface 10 0 -93.37%
BenchmarkBaselineVariableIncrement 2 1 -0.50%
@feyeleanor
feyeleanor / this does work
Created May 27, 2014 22:47
unexpected goroutine behaviour
package main
import (
. "fmt"
. "net/http"
)
const ADDRESS = ":1024"
const SECURE_ADDRESS = ":1025"
func main() {
@feyeleanor
feyeleanor / this doesn't
Created May 30, 2014 12:29
Goroutine launch puzzler
package main
import (
. "fmt"
. "net/http"
)
const ADDRESS = ":1024"
const SECURE_ADDRESS = ":1025"
func main() {