List:MySQL++« Previous MessageNext Message »
From:Drew Vogel Date:January 17 2006 5:53pm
Subject:Compile time
View as plain text  
Does anyone on the list have tips for reducing compile times for MySQL++ 
code (read: template instantiations) with g++? I have a source file that 
contains 6 ResUse and 6 Row objects and it takes g++ 4.0.3 over 2 
minutes to compile it on my 1.8 GHz/512 MB machine.

I've used the -frepo option in the past, but because most of my source 
files use both MySQL++ code and Boost code, I cannot use the -frepo 
option (Boost breaks with -frepo).

When I search Google, I find many references to -fexternal-templates, 
but this option is deprecated in g++ 4.0.x. However I can't find a good 
explanation or discussion of why it has been deprecated or what should 
be used in its stead.

My code uses 1 Connection object and 1 Query object. It uses 1 ResUse 
object and 1 Row object per call to Query::use(). I'm guessing that I 
could reduce compile time by instantiating fewer ResUse and Row objects. 
I've read numerous posts about elusive bugs due to reusing ResUse and 
Row objects. Here's a generalized form of my code:

Connection con;

try {
    Query qry = con.query();  
    qry << "select ... ";
    ResUse res1 = qry.use();

    try {
       while (Row row = res1.fetch_row()) {
    } catch (const EndOfResults& lastrow) {
          // Do nothing
    qry << "select ...";
    ResUse res2 = qry.use();
    try {
       while (Row row = res2.fetch_row()) {
    } catch (const EndOfResults& lastrow) {
          // Do nothing
} catch (const BadQuery& badq) {
    // crash

Drew Vogel

Compile timeDrew Vogel17 Jan
  • Re: Compile timeWarren Young17 Jan
  • Re: Compile timeChris Frey27 Jan