This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Large map<srting,string> Initialization
- From: "Tom Browder" <tbrowder at cox dot net>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Sun, 22 May 2005 07:39:01 -0500
- Subject: Large map<srting,string> Initialization
I need a map with many string pairs and I instantiate it like this:
map<const string,const string> mymap;
mymap.insert(make_pair("long_string1", "long_string_val1"));
...
mymap.insert(make_pair("long_string10000", "long_string_val10000"));
The strings generally are about 30-40 characters in length.
The source file is very long and g++ (4.0) takes a very long time (and a
large amount of memory) to compile it.
I have broken the file into smaller pieces (which helps with memory usage)
but the total compile time is about the same.
Note that the map is never modified after the initial load, it is merely
used for looking up the values.
Several questions:
1. Is there a better way to initialize such a map?
2. Are there g++ options that would help?
3. Are there linker/loader tricks that would help?
Thanks.
Tom Browder