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

Ben Pfaff blp at nicira.com
Fri Aug 21 17:48:49 UTC 2015

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?

More information about the dev mailing list