Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #7116

Re: Fast swapping of STL containers

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Fast swapping of STL containers
Date 2011-06-24 23:35 +1200
Message-ID <96jb3uFb9tU6@mid.individual.net> (permalink)
References (6 earlier) <64e7c240-e321-4550-b65b-265f6950e2d3@x38g2000pri.googlegroups.com> <96j62qFb9tU3@mid.individual.net> <a9dc3822-5555-463c-914c-b09262955d3a@e17g2000prj.googlegroups.com> <96j85mFb9tU5@mid.individual.net> <iu1s6s$rkd$1@hoshi.visyn.net>

Show all headers | View raw


On 06/24/11 11:25 PM, Kai-Uwe Bux wrote:
> Ian Collins wrote:
>
>> On 06/24/11 10:29 PM, ittium wrote:
>>
>> Please stop snipping attributions, it's rude!
>>
>>>> What difference does the number of calls make?  The operation is either
>>>> efficient, or it isn't.
>>>>
>>> thanks Ian for quick response.
>>> If operation is called limited number of times (e.g. only during
>>> initialization of a process) you can live with it. But if it is called
>>> large number of times and fast response time is required, complexity
>>> is an important criteria before using a routine.
>>
>> How is the library designer to no how often a routine will be called?
>> They will strive to get the best performance and that will be much
>> better than a user will ever get!
>
<snip>
>
> Lessons: (a) sometimes and with some effort, the library designer can not
> only measure how many times the routine will be called but also get an idea
> of the typical arguments; (b) if your particular use case differs from the
> case for which the library was optimized, you can sometimes rather easily
> beat the library implementation.

But not in the cast of an operation such as a container swap which can 
typically be implemented by exchanging some pointers to the internal 
data structure and a few other internal variables.  The user would have 
to perform a copy and erase.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Fast swapping of STL containers ittium <ittium@gmail.com> - 2011-06-23 06:45 -0700
  Re: Fast swapping of STL containers Victor Bazarov <v.bazarov@comcast.invalid> - 2011-06-23 10:05 -0400
    Re: Fast swapping of STL containers gwowen <gwowen@gmail.com> - 2011-06-23 08:07 -0700
      Re: Fast swapping of STL containers Rune Allnor <allnor@tele.ntnu.no> - 2011-06-23 22:49 -0700
        Re: Fast swapping of STL containers ittium <ittium@gmail.com> - 2011-06-24 02:16 -0700
          Re: Fast swapping of STL containers Ian Collins <ian-news@hotmail.com> - 2011-06-24 21:27 +1200
            Re: Fast swapping of STL containers ittium <ittium@gmail.com> - 2011-06-24 02:58 -0700
              Re: Fast swapping of STL containers Ian Collins <ian-news@hotmail.com> - 2011-06-24 22:09 +1200
                Re: Fast swapping of STL containers ittium <ittium@gmail.com> - 2011-06-24 03:29 -0700
                Re: Fast swapping of STL containers Ian Collins <ian-news@hotmail.com> - 2011-06-24 22:44 +1200
                Re: Fast swapping of STL containers Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-06-24 13:25 +0200
                Re: Fast swapping of STL containers Ian Collins <ian-news@hotmail.com> - 2011-06-24 23:35 +1200
                Re: Fast swapping of STL containers Pete Becker <pete@versatilecoding.com> - 2011-06-24 07:34 -0400
          Re: Fast swapping of STL containers Kai-Uwe Bux <jkherciueh@gmx.net> - 2011-06-24 13:34 +0200
        Re: Fast swapping of STL containers gwowen <gwowen@gmail.com> - 2011-06-24 03:26 -0700
          Re: Fast swapping of STL containers ittium <ittium@gmail.com> - 2011-06-24 03:30 -0700
            Re: Fast swapping of STL containers gwowen <gwowen@gmail.com> - 2011-06-24 04:01 -0700
              Re: Fast swapping of STL containers Pete Becker <pete@versatilecoding.com> - 2011-06-24 07:37 -0400
                Re: Fast swapping of STL containers gwowen <gwowen@gmail.com> - 2011-06-24 06:11 -0700
  Re: Fast swapping of STL containers Werner <werasm@gmail.com> - 2011-06-24 02:29 -0700
    Re: Fast swapping of STL containers Werner <werasm@gmail.com> - 2011-06-24 04:51 -0700
  Re: Fast swapping of STL containers hanukas <jukka@liimatta.org> - 2011-06-29 05:29 -0700
    Re: Fast swapping of STL containers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-29 15:45 +0000
      Re: Fast swapping of STL containers hanukas <jukka@liimatta.org> - 2011-06-30 23:46 -0700

csiph-web