[ovs-dev] [PATCH 8/8] json: increase Json string initial buffer size

Andy Zhou azhou at nicira.com
Fri Aug 21 21:56:48 UTC 2015

On Fri, Aug 21, 2015 at 10:48 AM, Ben Pfaff <blp at nicira.com> wrote:
> On Tue, Aug 11, 2015 at 05:55:14PM -0700, Andy Zhou wrote:
>> Json string are usually created and freed immediately. Thus, there
>> should not be any downside in creating a larger buffer initially to
>> avoid the cost of moving strings around in memory due to realloc()
>> call.
>> The following script is used as benchmark to measure number of
>> bytes reallocated:
>> ovs-vsctl add-br br0
>> for i in `seq 0 100`; do
>>    ovs-vsctl add-port br0 p$i
>> done
>> ovs-vsctl del-br br0
>> 'ds_bytes_relocated' coverage counter shows that the bytes relocated
>> are 2.5Mbytes/sec and 17Kbytes/sec, before and after this patch applied,
>> respectively.
> Is there a noticeable performance difference?

Unfortunately, No. Using the script mentioned in the commit message,
but increase the number
of ports to 500, I noticed on average, there are about 3% drop  (0.1ms
drop over 3.3s) in user space time.
It is not very noticeable. It is also within the variants of the tests.

More information about the dev mailing list