Opened 16 years ago

Last modified 13 years ago

#889 assigned Feature Requests (None)

Insane Dependencies

Reported by: nobody Owned by: az_sw_dude
Milestone: Component: date_time
Version: None Severity: Optimization
Keywords: Cc:

Description (last modified by Marshall Clow)

From: helvey@accelrys.com

Simply including boost/date_time/posix_time headers causes build times to skyrocket. Building a file that includes boost/date_time/posix_time/posix_time.hpp takes almost a minute, removing the header drops the time to less than a second.
Also why no conversions to time_t? It would be nice not to have include the header outside of translation units. :)

Change History (5)

comment:1 by az_sw_dude, 16 years ago

Logged In: YES 
user_id=579686
Originator: NO

Well, nothing even close on my Linux machine:

time g++-4.0 -I /opt/devTools/boost_rc_1_34 test.cpp

real    0m1.482s
user    0m1.140s

//test.cpp
#include "boost/date_time/posix_time/posix_time.hpp"

int main()
{

  return 0;
}

**************
That said, I agree that header isn't particularly "light weight" -- it does include a large number of files.  Some of this could be paired down by removing depedence on lexical_cast and shared_ptr in the core library.  Neither of these are quick changes to make.

As for time_t conversion, please submit that as an independent feature request, but be aware that there are many dates/times that will cause an exception on this conversion since there are many dates/time boost date-time can represent that time_t cannot.

Thx,

Jeff

comment:2 by Andrey Semashev, 13 years ago

Severity: Optimization
Type: BugsFeature Requests

I suspect most of the compilation overhead is due to IO support code, which aside from streams uses quite a few heavy things, such as lexical_cast and Boost.StringAlgo. It would be really great to move as much of this code to the compiled library as possible.

comment:3 by Andrey Semashev, 13 years ago

Request for conversions to time_t extracted to #3132.

comment:4 by Marshall Clow, 13 years ago

Description: modified (diff)

Is this still a useful request? Here's what I got on my MacBookPro (junk is just 'main', junk2 includes "boost/date_time/posix_time/posix_time.hpp")

DuoTwo:~ marshall$ time g++ -I /Marshall/Sources/boost/trunk junk.cpp

real 0m0.056s user 0m0.025s sys 0m0.023s

DuoTwo:~ marshall$ time g++ -I /Marshall/Sources/boost/trunk junk2.cpp

real 0m1.641s user 0m1.395s sys 0m0.228s

comment:5 by Andrey Semashev, 13 years ago

I think, it is useful. Boost.DateTime is included from other libraries, such as Boost.Thread. Now it brings in quite a few other dependencies, such as Boost.StringAlgo and Boost.LexicalCast. I think, making Boost.DateTime headers as lightweight as possible is a good thing.

One solution I have in mind is extracting as much IO code as possible into the compiled binary. However, I have other thoughts on optimizing IO that I wanted to implement during the extraction. But these tasks can be done independently.

Note: See TracTickets for help on using tickets.