<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I have been thinking recently about how Swift can be used to enable type-safe codebases for servers with high performance requirements. I’ve prototyped some of my ideas here:&nbsp;<a href="https://github.com/GeorgeLyon/Server" class="">https://github.com/GeorgeLyon/Server</a>&nbsp;(for an example see&nbsp;<a href="https://github.com/GeorgeLyon/Server/blob/master/Sources/Server/main.swift" class="">https://github.com/GeorgeLyon/Server/blob/master/Sources/Server/main.swift</a>)<div class=""><br class=""></div><div class="">The main difference between my implementation and swift-server/http is that all of my request handlers are structs which the Server owns and mutates as data comes in. Eventually, this can enable a model with zero allocations per request. In addition, having the server own the memory that the request handlers use enable optimizations based on cache locality.</div><div class=""><br class=""></div><div class="">With the current design, we effectively guarantee at least one allocation per request because we process the body by returning a closure. If this function doesn’t capture anything it may be just a pointer but it is very likely it at least needs the ResponseWriter. My design doesn’t suffer from this limitation.</div><div class=""><br class=""></div><div class="">If this is something the community is interested in, I will gladly put together a PR,</div><div class="">George</div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>