This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 12/19] read/write_pieced_value: Drop 'buffer_size' variable


On Tue, May 16 2017, Yao Qi wrote:

> Andreas Arnez <arnez@linux.vnet.ibm.com> writes:
>
> Patch is good to me, a nit below,
>
>> @@ -1806,12 +1805,8 @@ read_pieced_value (struct value *v)
>>  	this_size_bits = max_offset - offset;
>>  
>>        this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
>> +      buffer.reserve (this_size);
>
> I noticed that buffer is only used within the for loop, so probably we
> can move it into the loop, and do "std::vector<gdb_byte> buffer (this_size);"

I thought there might be a slight performance benefit in keeping the
buffer variable across loop iterations and just '.reserve' more space
when needed.  This was probably the original intention as well.

--
Andreas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]