Skip to content

Commit 6f16086

Browse files
committed
profiling/timing: elaborate on deferred function evaluation
1 parent dbb6189 commit 6f16086

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

profiling/timing.md

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ func Duration(invocation time.Time, name string) {
2626

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

3133
y := big.NewInt(1)

0 commit comments

Comments
 (0)