// Sample benchmarks to test which function is better for converting
// an integer into a string. First using the fmt.Sprintf function,
// then the strconv.FormatInt function and then strconv.Itoa.
package listing05_test
import (
"fmt"
"strconv"
"testing"
)
// BenchmarkSprintf provides performance numbers for the
// fmt.Sprintf function.
func BenchmarkSprintf(b *testing.B) {
number := 10
b.ResetTimer()
for i := 0; i < b.N; i++ {
fmt.Sprintf("%d", number)
}
}
// BenchmarkFormat provides performance numbers for the
// strconv.FormatInt function.
func BenchmarkFormat(b *testing.B) {
number := int64(10)
b.ResetTimer()
for i := 0; i < b.N; i++ {
strconv.FormatInt(number, 10)
}
}
// BenchmarkItoa provides performance numbers for the
// strconv.Itoa function.
func BenchmarkItoa(b *testing.B) {
number := 10
b.ResetTimer()
for i := 0; i < b.N; i++ {
strconv.Itoa(number)
}
}
$w
top of page
Dress To Impress
Accountability
2525 undefined
프로그램을 완료하면 수료증을 발급 받을 수 있습니다.
모든 프로그램 단계를 완료한 참가자에게 배지가 수여됩니다.
소개
This program is designed to help you stay accountable and achieve your goals. Through a series of structured activities and regular check-ins, you will learn how to set realistic goals, track your progress, and stay motivated. Whether you're looking to improve your personal or professional life, this program will provide you with the tools and support you need to succeed.