Re: Vector vs std::vector

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 30 Jan 2014 09:29:46 +1300

On 2014-01-30 07:52, Alex Rousskov wrote:
> On 01/29/2014 07:08 AM, Kinkie wrote:
>
>> Amos has asked me over IRC to investigate any performance
>> differences between Vector and std::vector. To do that, I've
>> implemented astd::vector-based implementation of Vector
>> (feature-branch: lp:~squid/squid/vector-to-stdvector).
>
> Does Launchpad offer a way of generating a merge patch/diff on the
> site?
> Currently, I have to checkout the branch and do "bzr send" to get the
> right diff. Is there a better way?
>
>
>> I've then done the performance testing using ab. The results are in: a
>> Vector-based squid is about 3% speedier than a std::vector based
>> squid.
>
>
>> This may also be due to some egregious layering by users of Vector. I
>> have seen things which I would like to correct, also with the
>> objective of having Vector implement the same exact API as std::vector
>> to make future porting easier.
>
> Can you give any specific examples of the code change that you would
> attribute to a loss of performance when using std::vector? I did not
> notice any obvious cases, but I did not look closely.

One of the things to check is memory management. Squid::Vector<> uses
xmalloc/xfree. Does the performance even up anything when those are
detatched? (we can implement custom allocator for std::vector's later if
useful).

Amos
Received on Wed Jan 29 2014 - 20:29:52 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 30 2014 - 12:00:15 MST