From b861d0e511f78020c085c9143a169d9b25e69dcd Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 3 Feb 2020 23:20:44 +0200 Subject: [PATCH] Force inline gregorian::date::date(special_values) to improve perf At least GCC 6.5.0, 7.4.0 and 8.3.0 fail to inline gregorian::date::date(special_values) when constructing posix_time::ptime and possibly other types. This leads to large performance overheads for a operation that should ideally be a store of a constant to some memory location. --- include/boost/date_time/gregorian/greg_date.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/date_time/gregorian/greg_date.hpp b/include/boost/date_time/gregorian/greg_date.hpp index 448ea90fa..c38ea873a 100644 --- a/include/boost/date_time/gregorian/greg_date.hpp +++ b/include/boost/date_time/gregorian/greg_date.hpp @@ -73,7 +73,7 @@ namespace gregorian { date_time::date(rhs) {} //! Constructor for infinities, not a date, max and min date - explicit date(special_values sv): + BOOST_FORCEINLINE explicit date(special_values sv): date_time::date(date_rep_type::from_special(sv)) { if (sv == min_date_time)