Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View davecheney's full-sized avatar
🔥
more cowbell

Dave Cheney davecheney

🔥
more cowbell
View GitHub Profile
@davecheney
davecheney / bm_test.go
Last active October 2, 2023 02:34
Which is faster ? map[string]bool or map[string]struct{} ?
package bm
import (
"testing"
)
var mb = map[string]bool{
"alpha": true,
"beta": true,
"gamma": true,
@davecheney
davecheney / patch.diff
Created April 7, 2016 11:08
Diffy McDiffface
diff --git a/src/errors/errors.go b/src/errors/errors.go
index b8a4692..ba1e239 100644
--- a/src/errors/errors.go
+++ b/src/errors/errors.go
@@ -10,6 +10,10 @@ func New(text string) error {
return &errorString{text}
}
+type Error string
+
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// junkterm is a quick and dirty serial terminal.
package main
import (
"io"
"log"
"os"
"github.com/pkg/term"
"github.com/spf13/cobra"
@davecheney
davecheney / go1.0-vs-go1.11.txt
Created October 7, 2018 11:13
test/bench/go1 benchmark results
name old time/op new time/op delta
BinaryTree17 5.44s ± 2% 3.27s ± 2% -39.90% (p=0.000 n=20+19)
Fannkuch11 4.95s ± 2% 2.68s ± 2% -45.87% (p=0.000 n=20+20)
FmtFprintfEmpty 142ns ± 2% 49ns ± 3% -65.39% (p=0.000 n=20+18)
FmtFprintfFloat 765ns ± 2% 260ns ± 2% -66.02% (p=0.000 n=20+20)
FmtFprintfInt 341ns ± 2% 95ns ± 2% -72.08% (p=0.000 n=19+20)
FmtFprintfIntInt 554ns ± 2% 150ns ± 1% -72.95% (p=0.000 n=20+19)
FmtFprintfPrefixedInt 497ns ± 3% 178ns ± 3% -64.12% (p=0.000 n=20+20)
FmtFprintfString 466ns ± 2% 86ns ± 3% -81.54% (p=0.000 n=20+20)
FmtManyArgs 2.23µs ± 2% 0.59µs ± 1% -73.46% (p=0.000 n=20+17)
odessa(~/src/github.com/pkg/mach) % cat sys_darwin_amd64.s
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// System calls and other sys.stuff for AMD64, Darwin
// See http://fxr.watson.org/fxr/source/bsd/kern/syscalls.c?v=xnu-1228
// or /usr/include/sys/syscall.h (on a Mac) for system call numbers.
//
name old time/op new time/op delta
BinaryTree17-8 2.36s ± 9% 2.42s ± 2% ~ (p=0.053 n=10+9)
Fannkuch11-8 2.36s ± 1% 2.15s ± 2% -8.70% (p=0.000 n=10+10)
FmtFprintfEmpty-8 33.1ns ± 3% 34.1ns ± 5% ~ (p=0.234 n=9+10)
FmtFprintfString-8 56.4ns ± 2% 58.8ns ± 2% +4.37% (p=0.000 n=10+9)
FmtFprintfInt-8 62.0ns ± 3% 65.1ns ± 3% +5.10% (p=0.000 n=10+10)
FmtFprintfIntInt-8 98.5ns ± 2% 101.2ns ± 2% +2.72% (p=0.000 n=10+8)
FmtFprintfPrefixedInt-8 105ns ± 3% 108ns ± 4% +2.85% (p=0.001 n=10+10)
FmtFprintfFloat-8 165ns ± 1% 164ns ± 1% ~ (p=0.384 n=8+10)
FmtManyArgs-8 415ns ± 1% 412ns ± 2% ~ (p=0.148 n=9+10)
package main
import (
"fmt"
"sync"
"unsafe"
)
func main() {
var wg sync.WaitGroup
package main
import (
"github.com/howeyc/fsnotify"
"log"
)
func main() {
watcher, err := fsnotify.NewWatcher()
if err != nil {

Title

Status: {draft,in review, approved/declined}

Goals

  • goal one
  • goal two (optional)
  • goal three (pushing it, don't try to boil all the oceans in one sitting)