Skip to content

Instantly share code, notes, and snippets.

Eleanor McHugh feyeleanor

View GitHub Profile
@feyeleanor
feyeleanor / map_immutability.go
Created Dec 17, 2015
Example showing difference between storing struct and *struct in a string
View map_immutability.go
package main
import "fmt"
type S struct {
I int
}
func main() {
m1 := map[string]S{"0": S{0}, "1": S{1}}
@feyeleanor
feyeleanor / this doesn't
Created May 30, 2014
Goroutine launch puzzler
View this doesn't
package main
import (
. "fmt"
. "net/http"
)
const ADDRESS = ":1024"
const SECURE_ADDRESS = ":1025"
func main() {
@feyeleanor
feyeleanor / this does work
Created May 27, 2014
unexpected goroutine behaviour
View this does work
package main
import (
. "fmt"
. "net/http"
)
const ADDRESS = ":1024"
const SECURE_ADDRESS = ":1025"
func main() {
@feyeleanor
feyeleanor / go 1.1 performance compared to go 1.0.3
Created May 17, 2013
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
View go 1.1 performance compared to go 1.0.3
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 / gospeed with go 1.1
Created May 17, 2013
Run of http://github.com/feyeleanor/gospeed on 2012 Aluminium MacBook 2.5GHz Core i5 with 16GB RAM using Go 1.1
View gospeed with 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 / gospeed with go 1.1beta2 revision d58997478ec6
Created Apr 13, 2013
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
View gospeed with go 1.1beta2 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.0.3
Created Apr 13, 2013
Run of http://github.com/feyeleanor/gospeed on 2012 Aluminium MacBook 2.5GHz Core i5 with 16GB RAM using Go 1.0.3.
View gospeed with 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 / mbp2012 benchmarks
Created Aug 30, 2012
GoSpeed benchmarks on a 13" MBP mid-2012 with 16GB RAM and 2.5 GHz Intel Core i5
View mbp2012 benchmarks
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 / dnsruby-naptr-ordering.rb
Created Aug 14, 2012
Ordering NAPTR records with Dnsruby
View dnsruby-naptr-ordering.rb
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 / gospeed on raspberrypi
Created Jul 13, 2012
first attempt to run the gospeed micro-benchmarks on a raspberrypi
View gospeed on 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
You can’t perform that action at this time.