lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master ce480d0 1/6: Revert "Resolve issue noted 2013


From: Greg Chicares
Subject: [lmi-commits] [lmi] master ce480d0 1/6: Revert "Resolve issue noted 20131011T1213Z"
Date: Fri, 16 Apr 2021 18:12:49 -0400 (EDT)

branch: master
commit ce480d0446324cfcd270a9eac99fd8f54ab558c6
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Revert "Resolve issue noted 20131011T1213Z"
    
    This reverts commit cbfe1d1427340fd88d2a95bf9e7283a6a4db22d9.
    
    The 2013 issue is no longer reproducible. If anything, switching from
    a pointer to a reference now improves speed slightly:
      Prems     : 1.072e-07 s mean; 0 us least of 93290 runs [reference]
      Prems     : 1.114e-07 s mean; 0 us least of 89768 runs [pointer]
    so it would seem that compilers have simply improved.
---
 gpt_commutation_functions.cpp | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/gpt_commutation_functions.cpp b/gpt_commutation_functions.cpp
index 54203e6..77e683d 100644
--- a/gpt_commutation_functions.cpp
+++ b/gpt_commutation_functions.cpp
@@ -221,12 +221,6 @@ gpt_cf_triad::gpt_cf_triad
 /// but then sometimes one would need to be thrown away (as when
 /// specified amount is determined by a GLP or GSP strategy).
 ///
-/// It would seem more natural to use a reference as in revision 5778,
-/// instead of a pointer. However, that alternative is more than an
-/// order of magnitude slower with both gcc-3.4.5 and como-4.3.10.1,
-/// as though they invoke the gpt_commfns copy ctor due to the throw-
-/// expression in the conditional-expression.
-///
 /// Asserted preconditions: Duration is within its natural bounds, and
 /// other members of 'args' are nonnegative.
 ///
@@ -253,14 +247,13 @@ double gpt_cf_triad::calculate_premium
     LMI_ASSERT(0.0 <= args.qab_child_amt );
     LMI_ASSERT(0.0 <= args.qab_waiver_amt);
 
-    gpt_commfns const*const pcf =
-          (oe_glp == glp_or_gsp && mce_option1_for_7702 == dbo) ? &cf_glp_dbo_1
-        : (oe_glp == glp_or_gsp && mce_option2_for_7702 == dbo) ? &cf_glp_dbo_2
-        : (oe_gsp == glp_or_gsp                               ) ? &cf_gsp
+    gpt_commfns const& cf =
+          (oe_glp == glp_or_gsp && mce_option1_for_7702 == dbo) ? cf_glp_dbo_1
+        : (oe_glp == glp_or_gsp && mce_option2_for_7702 == dbo) ? cf_glp_dbo_2
+        : (oe_gsp == glp_or_gsp                               ) ? cf_gsp
         : throw std::runtime_error("Cannot determine GPT assumptions.")
         ;
-    LMI_ASSERT(nullptr != pcf); // Redundant: demonstrably cannot fail.
-    double const z = pcf->calculate_premium(glp_or_gsp, args);
+    double const z = cf.calculate_premium(glp_or_gsp, args);
     LMI_ASSERT(0.0 <= z);
     return z;
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]