Monday, May 5, 2014

Scribbles from GopherCon 2014

Just a few notes I jotted down when I wasn't too mesmerized by the presentations... they probably won't make sense unless you were there or can see the talks. I'm mostly posting these for my own benefit. Anyway...

High Performance Go

  • Use go tool pprof (linux)
  • Avoid short-lived objects on the heap
  • Use the stack or make long-lived objects
  • Benchmark standard library builtins (strconv)
  • Benchmark builtins (defer, hashmap)
  • Don't use channels in performance-critical paths

CSP (Communicating sequential processes)

Unbuffered channels are nice because there's no ambiguity: you know that both sides are communicating right now, and are synchronizing.

Nil channels block; they can be used in selects to know when multiple channels are closed

Bluetooth Low Energy (BLE) and Embedded Go

If you're worried about GC pauses, think about the number of allocs as much as the size of your allocs.

Sysadmins

You don't need to have a big problem to solve to use Go.

Heka (on streaming data)

Basic pattern: read in data from a stream, split at record boundaries, transcode the records to a common format, route to the appropriate service in its own format.

Bind a single struct to a goroutine (or a single goroutine to a struct).

High-performance database in Go

(From basic OS classes) How to think about performance: optimize the following from least optimization efforts to most: Memory access, mutual exclusion, memory allocation, disk I/O, network I/O

MongoDB and Go

Rethink using Rethink.

But maybe rethink using Mongo, too. Choose the right tool for the job.

database/sql

The DB type represents your database; it is not a connection.