企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
> ### 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)))) } ~~~ > ### 效果图 > ![](https://img.kancloud.cn/04/f8/04f82d46904f780f3f7229f91b84002e_1013x645.png)