Large map<srting,string> Initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux