You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When it comes to Netty -> Finagle -> Finch, the HTTP body lifecycle is ChannelBuffer -> Buf -> String -> CaseClass. If we'd be able to teach jawn to work with Buf instead of String, we'd be able to go directly from Buf to CaseClass thereby eliminating that meaningless to-string conversion, which in fact alllocates O(n^2) bytes.
This would be a huge win for Finch users, but this requires some refactoring around DecodeRequest. The idea of top of my head is to actually keep DecodeRequest a string-based type-class and use it for params, headers, etc (i.e., param("foo").as[Int]) and introduce a new type-class FromRequest = Request => A (as a symmetric version to ToResponse) to be able to grab content: Buf from the request if we need it and not perform the to-string conversion. In this case, body readers should use the FromRequest type-class via the as method.
I'm totally fine to start with Circe (make it decode JSON from Buf) and keep the rest of the JSON lirbaries we support working with strings.
The text was updated successfully, but these errors were encountered:
When it comes to Netty -> Finagle -> Finch, the HTTP body lifecycle is
ChannelBuffer
->Buf
->String
->CaseClass
. If we'd be able to teach jawn to work withBuf
instead ofString
, we'd be able to go directly fromBuf
toCaseClass
thereby eliminating that meaningless to-string conversion, which in fact alllocates O(n^2) bytes.This would be a huge win for Finch users, but this requires some refactoring around
DecodeRequest
. The idea of top of my head is to actually keepDecodeRequest
a string-based type-class and use it for params, headers, etc (i.e.,param("foo").as[Int]
) and introduce a new type-classFromRequest = Request => A
(as a symmetric version toToResponse
) to be able to grabcontent: Buf
from the request if we need it and not perform the to-string conversion. In this case,body
readers should use theFromRequest
type-class via theas
method.I'm totally fine to start with Circe (make it decode JSON from
Buf
) and keep the rest of the JSON lirbaries we support working with strings.The text was updated successfully, but these errors were encountered: