性能测试使用benchmark,性能分析使用pprof,二者可以同时进行。
示例代码:
package benchmarktest
import (
"strings"
"testing"
)
func BenchmarkConcatStringByAdd(b *testing.B) {
elems := []string{
"1"
性能测试使用benchmark,性能分析使用pprof,二者可以同时进行。
示例代码:
package benchmarktest
import (
"strings"
"testing"
)
func BenchmarkConcatStringByAdd(b *testing.B) {
elems := []string{
"1"