I'm not sure this will work as an API. One problem I see with this is that
it is circumventing the engine's flow control logic. If you notice there is
logic inside send() to update counters on the session. Unless I've missed
something your patch doesn't seem to have equivalent logic. This might just
be an oversight, but I don't see how you could easily add the same logic
since you don't know how many bytes the payload is until much much later on
in the control flow of the engine.

Can you supply some more detail as to why it got 5% faster? If it was
merely avoiding the copy, then I can think of some ways we could avoid that
copy without changing the API quite so drastically, e.g. just overload
send() to take some sort of releasable buffer reference.

FWIW, I think that a good buffer abstraction that we could use everywhere
would help a lot. I suspect having distinct abstractions for payload
buffers vs encodable buffers vs decodable buffers is just going to result
in lots of unnecessary conversions.

--Rafael

On Tue, May 13, 2014 at 11:19 AM, Clebert Suconic <csuco...@redhat.com>wrote:

> I have been playing with the API, and there is one change that would make
> the API clearer IMO.
>
>
> Right now you have to send a delivery, and then call send(bytes) to add
> Bytes to the delivery what will make it copy data to the Delivery and self
> expand the buffer.
>
>
>
> I have played with a change that made it 5% faster than the most optimal
> way to expand the payload on the Delivery (using the same buffer over and
> over)
>
>
> And 15% on a brief calculation against creating the buffer every time...
> but there are cases where this could be a bit worse.
>
>
>
> Basically I have created an interface called Payload, and added a method
> setPayload on Delivery.
>
>
>
> I'm not sure yet how I would implement framing into multiple packages..
> but I think it could be done.. this is just a prototyped idea:
>
>
>
> https://github.com/clebertsuconic/qpid-proton/commit/02abe61fc54911955ddcce77b792a153c5476aef
>
>
>
> in case you want to fetch the buffer from my git, it's this branch:
> https://github.com/clebertsuconic/qpid-proton/tree/payload
>
>
>
> In any case I liked the idea of the setPayload better than
> sender.send(bytes) to set the payload of a message.
>
>
>
> Ideas?

Reply via email to