🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
> ### Http信息采集 ~~~ package main import ( "fmt" "math/rand" "net/http" _ "net/http/pprof" "time" ) func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { for i := 0; i < 10; i++ { actionSort(w) } }) http.ListenAndServe(":9000", nil) } func actionSort(w http.ResponseWriter) { rand.Seed(time.Now().Unix()) number := make([]int, 30000, 10000000) for k, _ := range number { number[k] = rand.Intn(100) } L := len(number) BubbleSort(w, number, L) } func BubbleSort(w http.ResponseWriter, data []int, L int) { t := time.Now() for i := 0; i < L; i++ { for j := i + 1; j < L; j++ { if data[i] > data[j] { data[i], data[j] = data[j], data[i] } } } w.Write([]byte(fmt.Sprintln("BubbleSort - Time:", time.Since(t)))) } ~~~ > ### 效果图 ![](/D:/%E6%AD%A3%E5%BC%8F%E6%A1%8C%E9%9D%A2/Golang%E5%B7%A5%E4%BD%9C%E7%AC%94%E8%AE%B0/book/Golang%E5%B7%A5%E4%BD%9C%E7%AC%94%E8%AE%B0/images/QQ%E6%88%AA%E5%9B%BE20181031170140.jpg)