[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: std::vector is slow

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Mon, 25 Apr 2011 17:35:12 +0200

On 25.04.2011 16:00, Oto BREZINA wrote:
> On 2011-04-25 14:53, Stefan Küng wrote:
>> On 25.04.2011 14:19, Oto BREZINA wrote:
>>> I have implemented some cache but everything slows down.
>>> I found that std::vector is slow do we have alternative, different
>>> setting or something to speed it up ?
>> What operation with a vector is slow? Can't be all of them...
> for example clear()
> Compare TortoiseDOC_jp with TortoiseDOC_zn, select all left text and
> select use block (alternatively use this file).
> Then hit undo it will take some secs. Try to debug end will found that
> clearing it taking that time - at least my last test look like that
> (can't debug right now).
> After reading some post I found it may be because of DEBUG build where
> lot of tests are enabled.

You most likely won't find anything faster than clear(). All that does
is to release all objects stored in the vector (i.e. do nothing for
integral types, call the deconstructor of class objects). It doesn't
even necessarily free the memory of the vector itself.

Even if you would use a simple array, you won't get much faster.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2724046
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-04-25 17:35:23 CEST

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.