This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]