<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 11 Dec 2017, at 01:27, George Leontiev via swift-server-dev <<a href="mailto:swift-server-dev@swift.org" class="">swift-server-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div 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: <a href="https://github.com/GeorgeLyon/Server" class="">https://github.com/GeorgeLyon/Server</a> (for an example see <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></div></blockquote><div><br class=""></div><div>I assume when you say “zero allocations per request” you mean “zero allocations of application data per request”, as we are presumably allocating some memory to process the HTTP.</div><div><br class=""></div><div>Otherwise this design seems completely reasonable: using structures instead of closures is definitely a perfectly valid approach. I’m +0: there are benefits and costs to either model, and so don’t object to either design.</div><div><br class=""></div><div>Cory</div></div></body></html>