Skip to content

Latest commit

 

History

History
 
 

2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

go语言的优化

持续中...

  • 减少slice或者map的自动扩容问题,因为扩容就意味着要数据的复制,所以尽量有多少东西就设置多少的len即可

  • 减少不必要的escape to heap 这叫做 逃逸到堆 本来在栈中的数据,经过指针就可以逃逸到堆中,而堆中的数据是需要垃圾回收的,所以有的时候这样会有不必要的速度损失。

  • 尽量使用select去接收chan,这样可以有更加优雅的处理方法