Returning the buffer is cheap assuming that you have one already.
Otherwise you have the cost of object creation, which - depending on the
length of the buffer content - will be more expensive than the potential
memcpy.

In what places do you think it would make sense to return a buffer
object instead of a string?

arne


On 09/03/14 11:10, Stephen R. van den Berg wrote:
> One other thing:
> 
> Why not return IOBuffers practically everywhere, and then let the
> caller decide when and if to cast them to a string?
> It gets rid of excessive method diversification due to there needing
> to be a string and a buffer returning one.
> Returning a buffer is cheap, it doesn't copy the content.
> 

  • IOBuffer vs. Buffe... Stephen R. van den Berg
    • Re: IOBuffer ... Stephen R. van den Berg
      • Re: IOBuf... Stephen R. van den Berg
        • Re: I... Per Hedbor () @ Pike (-) developers forum
      • Re: IOBuf... Stephen R. van den Berg
        • Re: I... Arne Goedeke
          • R... Stephen R. van den Berg
            • ... Per Hedbor () @ Pike (-) developers forum
              • ... Per Hedbor () @ Pike (-) developers forum
                • ... Per Hedbor () @ Pike (-) developers forum
                • ... Peter Bortas @ Pike developers forum
                • ... Per Hedbor () @ Pike (-) developers forum
                • ... Henrik Grubbstr�m (Lysator) @ Pike (-) developers forum
                • ... Per Hedbor () @ Pike (-) developers forum
                • ... Per Hedbor () @ Pike (-) developers forum
      • Re: IOBuf... Per Hedbor () @ Pike (-) developers forum

Reply via email to