Two avoidable per-request allocations on the proxied-request hot path:
RouteEntry is deep-cloned per request (the handler closure captures it by value; axum clones the closure per request, deep-cloning its String fields). Wrap in Arc<RouteEntry> so the per-request clone is a single refcount bump.
grpc_path is re-parsed into PathAndQuery on every request in both the unary and streaming handlers. Parse it once at route-build time and store the PathAndQuery (its clone is a cheap Bytes refcount bump). This also moves invalid-path detection to startup instead of a per-request 500 branch.
Both are zero-correctness-risk micro-optimizations on the hottest path; SIMD/wildcopy are not applicable (no hot scalar byte loops; byte work lives in serde_json / prost / hyper).
Estimate: 2h
Two avoidable per-request allocations on the proxied-request hot path:
RouteEntryis deep-cloned per request (the handler closure captures it by value; axum clones the closure per request, deep-cloning itsStringfields). Wrap inArc<RouteEntry>so the per-request clone is a single refcount bump.grpc_pathis re-parsed intoPathAndQueryon every request in both the unary and streaming handlers. Parse it once at route-build time and store thePathAndQuery(its clone is a cheapBytesrefcount bump). This also moves invalid-path detection to startup instead of a per-request 500 branch.Both are zero-correctness-risk micro-optimizations on the hottest path; SIMD/wildcopy are not applicable (no hot scalar byte loops; byte work lives in serde_json / prost / hyper).
Estimate: 2h