首页 > 代码库 > golang测试StringBuilder

golang测试StringBuilder

 1 package main 2  3 import ( 4     "fmt" 5     "git.oschina.net/ha666/golibs" 6     "time" 7 ) 8  9 func main() {10     var counts uint64 = 011     var index int = 012     var start int64 = golibs.UnixNano()13     var end int64 = golibs.UnixNano()14     for {15         index++16         time.Sleep(time.Millisecond)17         var data *golibs.StringBuilder = golibs.NewStringBuilder()18         data.Append("sajdflksad")19         data.Append("\tjaksldflksafdlkj\t")20         data.Append(time.Now().UnixNano())21         abc := data.ToString()22         if len(abc) <= 0 {23             fmt.Println("出错")24         }25         if index >= 10000 {26             counts++27             end = golibs.UnixNano()28             fmt.Println(golibs.StandardTime(), "\t", (end-start)/1000000, "\t", counts, "\r\n")29             start = golibs.UnixNano()30             index = 031         }32     }33 }

 

golang测试StringBuilder