dbTalk Databases Forums  

Compile time

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Compile time in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Drew Vogel
 
Posts: n/a

Default Compile time - 01-17-2006 , 11:53 AM






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;
con.connect(...);

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.reset();
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



--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Warren Young
 
Posts: n/a

Default Re: Compile time - 01-17-2006 , 02:19 PM






Drew Vogel wrote:
Quote:
Does anyone on the list have tips for reducing compile times for MySQL++
code (read: template instantiations) with g++?
I take the view that C++, STL and MySQL++ do a tremendous amount of work
for the programmer, and they do most of that work at compile time. In
exchange for this, you get a program that runs very quickly -- compared
to, say, a Perl DBI based program -- and doesn't sap months of
development time.

If you wanted to trade development time for compile time, you could use
the MySQL C API instead.

I don't mean suggest that you take the option. It's just that there are
no free lunches, and you should know what you are trading to get the
benefits you have.

--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Chris Frey
 
Posts: n/a

Default Re: Compile time - 01-26-2006 , 06:20 PM



On Tue, Jan 17, 2006 at 11:53:41AM -0600, Drew Vogel wrote:
Quote:
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).
I haven't found mysql++ to cause super long compile times (perhaps I'm not
using it strenuously enough ), but I have found certain parts of Boost
to do it.

ResUse and Row don't seem that complicated to cause such a long compile time.

- Chris


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.