id summary reporter owner description type status milestone component version severity resolution keywords cc 2718 local_date_time noticeably faster than ptime oneill1979 az_sw_dude "We noticed recently that using a local_date_time in tight loops was several times faster than using a ptime object. As these are both based largerly on the same template code this was a surprise. It appears this is caused by the implementation of the operater+=/-= and was wondering if there was any justification for the difference or if this was just an oversight. {{{ #!cpp //.\boost\date_time\local_time\local_date_time.hpp local_date_time_base operator+=(const time_duration_type& td) { this->time_ = time_system_type::add_time_duration(this->time_,td); return *this; } }}} {{{ #!cpp //.\boost\date_time\time.hpp time_type operator+=(const time_duration_type& td) { time_ = (time_system::get_time_rep(date(), time_of_day() + td)); return time_type(time_); } }}} It looks like the ptime implementation is doing extra work to split the ptime into date and time_duration components and if it is changed to follow a similar pattern to that used in the local time the performance is then indistinguishable. {{{ #!cpp //.\boost\date_time\time.hpp time_type operator+=(const time_duration_type& td) { this->time_ = time_system::add_time_duration(this->time_, td); return time_type(time_); } }}} I can only think that maybe this was done to work around an issue and in which case should the same then be applied to the local time implementation? [http://www.nabble.com/user/SendEmail.jtp?type=user&user=627065 email via nabble]" Bugs new To Be Determined date_time Boost 1.37.0 Optimization