title: Compilation time for initialized vector of vectors of strings
body: <p>I am trying a C++ program where I have initialized a 2D vector as string. The vector is large though.</p>
  
  <pre><code>vector&lt; vector &lt;string&gt; InVector ={ {"Alpha1","Beta1","10.23","13.20"},
                                      {"Alpha2","Beta2","30.23","13.20"},
                                        ..
                                       .. 
                                     };
  </code></pre>
  
  <p>The vector InVector is large &mdash; in my case it is 1000x4.</p>
  
  <p>When I compile the program it takes too much time to compile; however, without fixed initialization of the vector it compiles very fast. With -O2 or O3 optimization the time is too much. </p>
  
  <p>Here is output from -ftime-report </p>
  
  <blockquote>
    <p>TOTAL : 79.02 0.67 80.53<br>
    314571 kB</p>
  </blockquote>
  
  <p>Any idea how I can improve the compilation time. </p>
  
  <p>Shall I initialize it as a array and then convert it to vector? Or is there any alternative to this approach. </p>
  
  <p>PS: If I read this vector from  a file then there is no problem.</p>