Reading List

Quick and Dirty Function Timing in Go from Liza Shulyayeva RSS feed.

Quick and Dirty Function Timing in Go

When I want to do some rough timing comparisons or get a quick idea of what part of Thing X is taking so long I sometimes just time a few functions. I used to do this by getting st := time.Now() at the beginning of the function and then time.Since(st) at the end. It recently hit me that the same thing could be achieved with less duplication and messiness to clean up (when removing the timings) with something like this: