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,921 of 33,346   
   Dave Harris to James K. Lowden   
   Re: insert [sorted] a node in a linked l   
   12 Mar 13 14:35:54   
   
   From: brangdonj@googlemail.com   
      
   In article <20130311161856.56518e70.jklowden@speakeasy.net>,   
   jklowden@speakeasy.net (James K. Lowden) wrote:   
   > I inserted just 100,000 randomly generated integers in a std list,   
   > vector, and set.  Not being a fan of O(n) performance, I'm not much   
   > of a list user myself.  I was stunned at how slow it was:   
      
   >   
   > list:		6m56.993s   
   > vector:	0m1.388s   
   > set: 		0m0.447s   
   > empty: 	0m0.334s	(no container, just /dev/urandom)   
      
   I'm mildly impressed at how fast set is. It avoids duplicates, so was   
   probably smaller than the vector towards the end. Was that a   
   significant factor?   
      
   It sounds like your test was all insertions and no look-up. I suspect   
   vector's relative performance would improve if insertions were   
   relatively rare. That is, traversing a vector with lower_bound is   
   probably quicker than traversing set's tree.   
      
   -- Dave Harris, Nottingham, UK.   
      
      
   --   
         [ 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