gortex 路由零分配的三個手法:sync.Pool 重用 Context、[4]string 的 smartParams、內嵌 responseWriter,再用 benchmem 驗證。
零分配靠三件事:逃逸分析決定變數落在 stack 還是 heap,sync.Pool 重用短命物件攤平 GC,同步原語單值用 atomic、一塊狀態用 Mutex、讀遠多於寫才用 RWMutex。
← 標籤