> On Tue, Aug 28, 2012 at 1:55 PM, Sa�l Ibarra Corretg�<
sag...@gmail.com> wrote:
>> Hi all,
>>
>> I'm looking into implementing a small performance optimization on pyuv,
>> which consists on creating the Python string object early (on alloc_cb) and
>> then passing its internal buffer to libuv, so later I don't need to copy any
>> buffer. This works because the Python object is not visible anywhere until
>> is given to the user in the on_read_cb, so we can mangle the internals ;-)
>>
>> However, the suggested size (64k) is quite big and shrinking the Python
>> string down so much actually has the opposite effect I'm trying to achieve
>> :-S If I disregard the suggested_size and use a smaller value, say 4096
>> results are as expected, that is, there is a performance gain in
>> preallocating the Python string object. (this pattern is used by CPython
>> itself)
>>
>> It would be nice to be able to set the suggested size when calling
>> uv_read_start, so that the user can control it. While I can do it in pyuv
>> I's rather mirror libuv as much as possible.
>>
>> Having that said, I noticed #495 and #505, so I'm wondering if there is any
>> timeline for it. Is it planned for version 0.10.0? If not, would a patch
>> adding suggested_size to uv_read_start be welcome? The idea would be to
>> store the suggested_size in the uv_stream_t struct and use it as we do now.
>> (if zero is passed the default 64k would be set)
>
> There's no need for that. suggested_size is exactly that, a
> suggestion. If you don't want to allocate 64K, then don't.
>
I see. I don't have really accurate benchmarks, but when testing (with
add extra stuff to pyuv with is not on libuv. I already did it once and