Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #8453
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: C Containers Library vs STL |
| Date | 2011-08-04 19:40 +1200 |
| Message-ID | <99v0n0Far7U5@mid.individual.net> (permalink) |
| References | (3 earlier) <jejj37prnheru64sshk40btqtan2ll8n5r@4ax.com> <j1clm8$ibc$1@speranza.aioe.org> <99u7p5Far7U1@mid.individual.net> <99ubh7Far7U2@mid.individual.net> <4e3a4419$0$3116$7b1e8fa0@news.nbl.fi> |
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. > In this case the (probably significant) speedup comes from removing the > need to make a memory allocation for each line. My point was the choice of container was the dominant player in this comparison. All of the above optimisations can be applied to either version. -- Ian Collins
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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