This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This was a benchmark that I used to understand how to use sync.Pool without allocations. | |
| // Pointers key as stated in the documentation, but how you use them is also important. | |
| // I wrote about it in https://blog.fraixed.es/post/move-to-heap-golang-std-pool | |
| // To execute the benchmarks use `go test -bench . -benchmem`. The only interesting part is the last | |
| // column, the `allocs/op`; when the benchmark function shows 0 is good, otherwise is bad. | |
| package tmp | |
| import ( | |
| "sync" |
OlderNewer