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


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

Re: C Containers Library vs STL

From jacob navia <jacob@spamsink.net>
Newsgroups comp.lang.c++
Subject Re: C Containers Library vs STL
Date 2011-08-04 16:25 +0200
Organization lccwin
Message-ID <j1ea4d$3kp$1@speranza.aioe.org> (permalink)
References (5 earlier) <99u7p5Far7U1@mid.individual.net> <99ubh7Far7U2@mid.individual.net> <4e3a4419$0$3116$7b1e8fa0@news.nbl.fi> <99v0n0Far7U5@mid.individual.net> <4e3aa9ba$0$2832$7b1e8fa0@news.nbl.fi>

Show all headers | View raw


Le 04/08/11 16:16, Juha Nieminen a écrit :
> Ian Collins<ian-news@hotmail.com>  wrote:
>> On 08/ 4/11 07:02 PM, Juha Nieminen wrote:
>>> Ian Collins<ian-news@hotmail.com>   wrote:
>>>> the run time drops to 0.66 seconds.
>>>
>>>     If you wanted to reduce the running time even further, and assuming the
>>> entire input file fits in RAM, what you could do is to read the entire
>>> file into RAM with one single fread() call and then use a std::set of
>>> char* (and the proper comparator), each pointer pointing to this single
>>> data block (which needs newlines replaced with null characters).
>>
>> Running more than once should be sufficient to cache the file in RAM.
>
>    That's not the point. The point was to avoid needless memory allocations.

In the C containers library the container ALWAYS owns the memory used
by the objects/keys. This means the given buffers are always copied
when you add an item.

What is the behavior in C++, it is different?

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


Thread

C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-03 22:40 +0200
  Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 09:13 +1200
    Re: C Containers Library vs STL Robert Wessel <robertwessel2@yahoo.com> - 2011-08-03 17:36 -0500
      Re: C Containers Library vs STL Robert Wessel <robertwessel2@yahoo.com> - 2011-08-03 17:38 -0500
        Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 01:30 +0200
          Re: C Containers Library vs STL Robert Wessel <robertwessel2@yahoo.com> - 2011-08-03 18:40 -0500
            Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 13:42 +0200
          Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 12:34 +1200
            Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 13:38 +1200
              Re: C Containers Library vs STL Juha Nieminen <nospam@thanks.invalid> - 2011-08-04 07:02 +0000
                Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 19:40 +1200
                Re: C Containers Library vs STL Juha Nieminen <nospam@thanks.invalid> - 2011-08-04 14:16 +0000
                Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 16:25 +0200
                Re: C Containers Library vs STL Nobody <nobody@nowhere.com> - 2011-08-04 21:40 +0100
            Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 09:42 +0200
              Re: C Containers Library vs STL Ian Collins <ian-news@hotmail.com> - 2011-08-04 19:59 +1200
              Re: C Containers Library vs STL Marc <marc.glisse@gmail.com> - 2011-08-04 12:47 +0000
                Re: C Containers Library vs STL jacob navia <jacob@spamsink.net> - 2011-08-04 15:17 +0200

csiph-web