gitalk icon indicating copy to clipboard operation
gitalk copied to clipboard

还咋优化?我是说Go程序

Open utterances-bot opened this issue 2 years ago • 4 comments

还咋优化?我是说Go程序

Go语言是一个极容易上手的语言,而且Go程序的优化套路基本上被大家莫得清清楚楚的,如果你有心,可以在互联网上搜出很多Go程序优化的技巧,有些文章可能只介绍了几个优化点,有些文章从CPU的架构到Slice预分配,再到通过pprof找性能的瓶颈点等等全

https://colobu.com/2022/10/17/a-first-look-at-arena/

utterances-bot avatar Oct 19 '22 06:10 utterances-bot

耗资源进行对象的便利和检查 => 遍历和检查

NineRec avatar Oct 19 '22 06:10 NineRec

windows性能下降为啥不去github提问题呢?我也测试了一遍,现在还是更差。。

dosgo avatar Nov 25 '22 01:11 dosgo

哈哈哈哈哈封面图那个go在造轮子笑死我了

moreoronce avatar Mar 28 '23 15:03 moreoronce

在我的macbook 上,使用arena反而会更慢。。。。

$ ./arena -arena 21 stretch tree of depth 22 check: 8388607, took: 1.620201961s 2097152 trees of depth 4 check: 65011712, took: 10.138215281s 524288 trees of depth 6 check: 66584576, took: 10.031974631s 131072 trees of depth 8 check: 66977792, took: 9.908927436s 32768 trees of depth 10 check: 67076096, took: 9.899569677s 8192 trees of depth 12 check: 67100672, took: 9.836554777s 2048 trees of depth 14 check: 67106816, took: 10.16687149s 512 trees of depth 16 check: 67108352, took: 9.962285097s 128 trees of depth 18 check: 67108736, took: 9.821624886s 32 trees of depth 20 check: 67108832, took: 10.89065282s long lived tree of depth 21 check: 4194303, took: 1m31.347158275s benchmark took: 1m32.987189945s

$ ./arena -arena=false 21 stretch tree of depth 22 check: 8388607, took: 930.961246ms 2097152 trees of depth 4 check: 65011712, took: 3.89845189s 524288 trees of depth 6 check: 66584576, took: 3.819460941s 131072 trees of depth 8 check: 66977792, took: 4.051081906s 32768 trees of depth 10 check: 67076096, took: 3.983512276s 8192 trees of depth 12 check: 67100672, took: 4.212204154s 2048 trees of depth 14 check: 67106816, took: 5.378939703s 512 trees of depth 16 check: 67108352, took: 7.639278434s 128 trees of depth 18 check: 67108736, took: 5.646779012s 32 trees of depth 20 check: 67108832, took: 5.259457814s long lived tree of depth 21 check: 4194303, took: 44.258680025s benchmark took: 45.18975953s

eleztian avatar Apr 19 '23 08:04 eleztian