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
@davecheney
davecheney / b_test.go
Created February 11, 2012 03:55
inlining vs unrolling
package b
import "testing"
// SIZE=1000 results (core i5 late 2011 mac mini, 10.7.3)
// % go test -v -run='XXX' -bench='.'
// PASS
// BenchmarkUpdate 500000 2996 ns/op
// BenchmarkManual 500000 4642 ns/op
// BenchmarkUnroll 1000000 2824 ns/op
package b
import "testing"
// SIZE=1000 results (core i5 late 2011 mac mini, 10.7.3) amd64
// % go test -v -run='XXX' -bench='.'
// PASS
// BenchmarkUpdate 500000 3064 ns/op
// BenchmarkManual 500000 5143 ns/op
// BenchmarkUnroll 1000000 2927 ns/op
// Inferno's libkern/memmove-arm.s
// http://code.google.com/p/inferno-os/source/browse/libkern/memmove-arm.s
//
// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
// Revisions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuova.com). All rights reserved.
// Portions Copyright 2009 The Go Authors. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
package main
import (
"log"
"time"
)
const TODO = 20000000
type Ob struct {
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
/*
enum Const {
ZERO,
ONE,
};
*/
import "C"
import "fmt"
package main
import (
"github.com/howeyc/fsnotify"
"log"
)
func main() {
watcher, err := fsnotify.NewWatcher()
if err != nil {
@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
--- 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)
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]