2021年11月2日

Golang 函数耗时统计

摘要: 1.朴素方法 在函数起始位置计算当前时间,在函数结束位置算出耗时。 package main import ( "fmt" "time" ) func sum(n int) int { startT := time.Now() //计算当前时间 total := 0 for i:=1; i <= n 阅读全文

posted @ 2021-11-02 19:25 ExplorerMan 阅读(812) 评论(0) 推荐(0) 编辑

导航