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. >
