Skip to content

Commit

Permalink
profiling/timing: elaborate on deferred function evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
tmrts committed Feb 27, 2017
1 parent dbb6189 commit 6f16086
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions profiling/timing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ func Duration(invocation time.Time, name string) {

```go
func BigIntFactorial(x big.Int) *big.Int {
// Arguments to a defer statement is immediately evaluated and stored.
// The deferred function receives the pre-evaluated values when its invoked.
defer profile.Duration(time.Now(), "IntFactorial")

y := big.NewInt(1)
Expand Down

0 comments on commit 6f16086

Please sign in to comment.