Speed up asynchttpserver significantly using all the previous changes
- Export socket field of AsyncHttpServer and addHeaders proc for templates - Make respond a template instead of proc because of how often it's called. This means no more "await" when invoking it. - Optimize respond template with special case for empty headers and Content-Length entry - newRequest doesn't allocate a hostname and body anymore because they're copied in later - Major changes to processClient to prevent allocations and copies
This commit is contained in:
parent
07a50caf64
commit
477b3594eb
2 changed files with 53 additions and 47 deletions
|
|
@ -200,7 +200,7 @@ template readInto*(buf: cstring, size: int, socket: AsyncSocket,
|
|||
res = recvIntoFut.read()
|
||||
res
|
||||
|
||||
template readIntoBuf(socket: AsyncSocket,
|
||||
template readIntoBuf*(socket: AsyncSocket,
|
||||
flags: set[SocketFlag]): int =
|
||||
var size = readInto(addr socket.buffer[0], BufferSize, socket, flags)
|
||||
socket.currPos = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue