首次提交:初始化项目代码

This commit is contained in:
sunct
2026-07-31 15:18:32 +08:00
commit d6393266b0
193 changed files with 14287 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package main
import (
"fmt"
"time"
)
func main() {
const loopCount = 100000 // 10万次拼接
var result string
start := time.Now()
for i := 0; i < loopCount; i++ {
result += fmt.Sprintf("item_%d,", i) // 每次拼接生成新字符串,内存分配频繁
}
fmt.Printf("fmt循环拼接耗时:%v\n", time.Since(start))
_ = result // 避免未使用变量警告
}