home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,965 of 33,346   
   =?ISO-8859-1?Q?=D6=F6_Tiib?= to David Lowndes   
   Re: Sequence container capacity after ca   
   01 Apr 13 11:14:08   
   
   From: ootiib@hot.ee   
      
   On Monday, 1 April 2013 11:04:47 UTC+3, David Lowndes  wrote:   
   > >Heap allocation/deallocation used to be a serious time consumer, but   
   > >AFAIK that problem was largely overcome more than a decade ago.   
   >   
   > It was?   
   > Do you have a reference to what you're alluding to there?   
      
   Allocations and deallocations are way cheaper than they were old   
   times. Dynamic memory still is not cost-free and there are still no   
   reasons to be wasteful. It is easy to measure what costs what. Million of   
   small allocations & deallocations will take like half a second on   
   modern hardware. For sane cases that is plenty but not for naive newbie   
   cases like for passing dynamic containers by value or for creating   
   temporary dynamic containers in tight loops.   
      
   For example ... just add two strings up to compare with third string, do   
   it millions of times and program hangs indeed. Such buggy algorithms   
   should be fixed instead of complaining that allocations are slow.   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca