Skip to content

Instantly share code, notes, and snippets.

View davecheney's full-sized avatar
🤔
i have concepts of a plan

Dave Cheney davecheney

🤔
i have concepts of a plan
View GitHub Profile
lucky(~/src) % go run panic.go
throw: all goroutines are asleep - deadlock!
Go runtime version: devel +a32219a715c5 Wed Dec 05 15:26:18 2012 +1100 linux/amd64
goroutine 1 [select (no cases)]:
main.main()
/home/dfc/src/panic.go:3 +0x18
goroutine 2 [syscall]:
created by runtime.main
@davecheney
davecheney / gist:4181046
Created December 1, 2012 08:04
golang freebsd/arm on the raspberry pi
# uname -a
FreeBSD raspberry-pi 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r243694M: Thu Nov 29 19:52:08 PST 2012 root@bsdbox:/src/FreeBSD/obj/arm.armv6/src/FreeBSD/head/sys/RPI-B arm
# ~/go/pkg/tool/freebsd_arm/go_bootstrap run ~/src/hellofreebsd.go
Hello, 世界
dfc@qnap:~/go/test/bench/go1$ ~/go/misc/benchcmp {old,new}.txt
benchmark old ns/op new ns/op delta
BenchmarkBinaryTree17 2147483647 2147483647 -0.90%
BenchmarkFannkuch11 2147483647 2147483647 -0.09%
BenchmarkGobDecode 181214200 179469200 -0.96%
BenchmarkGobEncode 73388200 72136100 -1.71%
BenchmarkGzip 2147483647 2147483647 +0.97%
BenchmarkGunzip 914986600 914847400 -0.02%
BenchmarkJSONEncode 878786200 870880200 -0.90%
BenchmarkJSONDecode 1999041000 2001263000 +0.11%
d.output[d.o] = uint8(code)
42ed4: e1a00806 lsl r0, r6, #16
42ed8: e1a00820 lsr r0, r0, #16
42edc: e20010ff and r1, r0, #255 ; 0xff
42ee0: e20150ff and r5, r1, #255 ; 0xff
42ee4: e5941000 ldr r1, [r4]
42ee8: e59fb8c0 ldr fp, [pc, #2240] ; 437b0 <compress/lzw.(*decoder).decode+0xa00>
42eec: e794300b ldr r3, [r4, fp]
42ef0: e5941000 ldr r1, [r4]
42ef4: e5942000 ldr r2, [r4]
--- prog list "addr" ---
0000 (/home/dfc/src/addr.go:5) TEXT addr+0(SB),$0-16
0001 (/home/dfc/src/addr.go:6) MOVW $s+0(FP),R0
0002 (/home/dfc/src/addr.go:6) MOVW 4(R0),R1
0003 (/home/dfc/src/addr.go:6) CMP $2,R1,
0004 (/home/dfc/src/addr.go:6) BHI ,6(APC)
0005 (/home/dfc/src/addr.go:6) BL ,runtime.panicindex+0(SB)
0006 (/home/dfc/src/addr.go:6) MOVW 0(R0),R0
0007 (/home/dfc/src/addr.go:6) ADD $8,R0
0008 (/home/dfc/src/addr.go:6) MOVW R0,.noname+12(FP)
@davecheney
davecheney / stress.bash
Created August 25, 2012 12:12
stress test your packages
#!/bin/bash
go test -c
PKG=$(basename $(pwd))
set -e
while true ; do
export GOMAXPROCS=$[ 1 + $[ RANDOM % 128 ]]
./$PKG.test $@ 2>&1
done
package main
import (
"github.com/howeyc/fsnotify"
"log"
)
func main() {
watcher, err := fsnotify.NewWatcher()
if err != nil {
package main
/*
enum Const {
ZERO,
ONE,
};
*/
import "C"
import "fmt"
diff -r d2213960ade2 src/cmd/5l/asm.c
--- a/src/cmd/5l/asm.c Sat Jul 14 15:59:52 2012 +0400
+++ b/src/cmd/5l/asm.c Sun Jul 15 19:45:39 2012 +1000
@@ -33,6 +33,7 @@
#include "l.h"
#include "../ld/lib.h"
#include "../ld/elf.h"
+#include "../ld/dwarf.h"
static Prog *PP;
package main
import (
"log"
"time"
)
const TODO = 20000000
type Ob struct {