You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Gary Gregory <ga...@gmail.com> on 2018/11/23 04:02:28 UTC

Remove IncomingHttpEntity and reuse InputStreamEntity

Hi All:

How about removing IncomingHttpEntity and reusing InputStreamEntity like
this:

https://pastebin.com/3LQ0Rfdv

?

Gary

Re: Remove IncomingHttpEntity and reuse InputStreamEntity

Posted by Gary Gregory <ga...@gmail.com>.
On Fri, Nov 23, 2018 at 8:40 AM Oleg Kalnichevski <ol...@apache.org> wrote:

> On Fri, 2018-11-23 at 08:36 -0700, Gary Gregory wrote:
> > On Fri, Nov 23, 2018 at 1:24 AM Oleg Kalnichevski <ol...@apache.org>
> > wrote:
> >
> > > On Thu, 2018-11-22 at 21:02 -0700, Gary Gregory wrote:
> > > > Hi All:
> > > >
> > > > How about removing IncomingHttpEntity and reusing
> > > > InputStreamEntity
> > > > like
> > > > this:
> > > >
> > > > https://pastebin.com/3LQ0Rfdv
> > > >
> > > > ?
> > > >
> > > > Gary
> > >
> > > I created IncomingHttpEntity on purpose. This class does not parse
> > > Content-Type and Contnent-Encoding encoding headers unless they are
> > > accessed by the application code. Header parsing is an expensive
> > > operation.
> > >
> >
> > Hi Oleg,
> >
> > Computation to get a Header's String value only happens when using
> > BufferedHeader#getValue(), all other Header implementations of
> > getValue()
> > access an instance variable.
> >
> > Questions:
> > - Is the implementaion of BufferedHeader#getValue() you only concern
> > here?
>
> Yes.
>
> > - BufferedHeader does not cache the result of its extraction oddly
> > enough.
> > If it is that expensive to do, why not cache it?
> >
>
> Why would anyone in their sane mind access the value multiple times?
> Generally, it is a performance vs memory footprint trade-off.
>

It's a public API. Predicting user's sanity is an exercise in futility ;-)

Gary


>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Re: Remove IncomingHttpEntity and reuse InputStreamEntity

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2018-11-23 at 08:36 -0700, Gary Gregory wrote:
> On Fri, Nov 23, 2018 at 1:24 AM Oleg Kalnichevski <ol...@apache.org>
> wrote:
> 
> > On Thu, 2018-11-22 at 21:02 -0700, Gary Gregory wrote:
> > > Hi All:
> > > 
> > > How about removing IncomingHttpEntity and reusing
> > > InputStreamEntity
> > > like
> > > this:
> > > 
> > > https://pastebin.com/3LQ0Rfdv
> > > 
> > > ?
> > > 
> > > Gary
> > 
> > I created IncomingHttpEntity on purpose. This class does not parse
> > Content-Type and Contnent-Encoding encoding headers unless they are
> > accessed by the application code. Header parsing is an expensive
> > operation.
> > 
> 
> Hi Oleg,
> 
> Computation to get a Header's String value only happens when using
> BufferedHeader#getValue(), all other Header implementations of
> getValue()
> access an instance variable.
> 
> Questions:
> - Is the implementaion of BufferedHeader#getValue() you only concern
> here?

Yes.

> - BufferedHeader does not cache the result of its extraction oddly
> enough.
> If it is that expensive to do, why not cache it?
> 

Why would anyone in their sane mind access the value multiple times?
Generally, it is a performance vs memory footprint trade-off.

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Remove IncomingHttpEntity and reuse InputStreamEntity

Posted by Gary Gregory <ga...@gmail.com>.
On Fri, Nov 23, 2018 at 1:24 AM Oleg Kalnichevski <ol...@apache.org> wrote:

> On Thu, 2018-11-22 at 21:02 -0700, Gary Gregory wrote:
> > Hi All:
> >
> > How about removing IncomingHttpEntity and reusing InputStreamEntity
> > like
> > this:
> >
> > https://pastebin.com/3LQ0Rfdv
> >
> > ?
> >
> > Gary
>
> I created IncomingHttpEntity on purpose. This class does not parse
> Content-Type and Contnent-Encoding encoding headers unless they are
> accessed by the application code. Header parsing is an expensive
> operation.
>

Hi Oleg,

Computation to get a Header's String value only happens when using
BufferedHeader#getValue(), all other Header implementations of getValue()
access an instance variable.

Questions:
- Is the implementaion of BufferedHeader#getValue() you only concern here?
- BufferedHeader does not cache the result of its extraction oddly enough.
If it is that expensive to do, why not cache it?

Gary


>
> Oleg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

Re: Remove IncomingHttpEntity and reuse InputStreamEntity

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2018-11-22 at 21:02 -0700, Gary Gregory wrote:
> Hi All:
> 
> How about removing IncomingHttpEntity and reusing InputStreamEntity
> like
> this:
> 
> https://pastebin.com/3LQ0Rfdv
> 
> ?
> 
> Gary

I created IncomingHttpEntity on purpose. This class does not parse
Content-Type and Contnent-Encoding encoding headers unless they are
accessed by the application code. Header parsing is an expensive
operation.

Oleg 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org