[Top][All Lists]

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

Re: [lmi] Input unification

From: Greg Chicares
Subject: Re: [lmi] Input unification
Date: Thu, 14 Aug 2008 02:13:24 +0000
User-agent: Thunderbird (Windows/20080708)

| The lesser [ship] will come and go, leave or take, and is yare;
| whereas the greater is slow.

On 2008-08-12 15:17Z, Greg Chicares wrote:
[...as one benefit of refactoring...]
> 'liblmi.dll' is now 28412716 bytes, versus 31693714 on 20080707:
> ten percent smaller.

I thought it good to record measurements justifying the name of
class 'yare_input'. Clearly it's yare in the sense of "prepared":
for example,
    int RetirementAge;
is ready for use in a calculation like (RetirementAge - IssueAge)
    tnr_attained_age RetirementAge;
is not, as 'tnr_attained_age' is a UDT with no 'operator int()'.
And it ought to fulfill the sense of "nimble" as well, because an
'int' can be loaded directly into a machine register; but another
aspect of that attribute can be measured.

Running this command repeatedly to stabilize timing:

time /MinGW_/bin/g++ -c -I /lmi/src/lmi -I /opt/lmi/third_party/include \
-DBOOST_STRICT_CONFIG -std=c++98 -ggdb -O2 /lmi/src/lmi/ihs_avdebug.cpp \

with and without the patch below, I observed these object sizes
and "total" times:

  without patch: 2.58 seconds, 246723 bytes
  with    patch: 2.75 seconds, 316672 bytes

Seven percent slower and twenty-eight percent bigger. What the
patch does is negate the advantage of using only the yare class
in an insurance-calculation module by writing mc_str() inline.
This quantifies just one benefit of factoring out the template
UDT header. I didn't measure runtime performance or the effect on
autodependency files; the measurements presented seem sufficient
to validate the design decision.

Index: ihs_avdebug.cpp
RCS file: /sources/lmi/lmi/ihs_avdebug.cpp,v
retrieving revision 1.31
diff -U 3 -r1.31 ihs_avdebug.cpp
--- ihs_avdebug.cpp     30 Jul 2008 12:31:06 -0000      1.31
+++ ihs_avdebug.cpp     14 Aug 2008 00:53:15 -0000
@@ -32,6 +32,7 @@
 #include "ihs_irc7702.hpp"
 #include "ihs_irc7702a.hpp"
 #include "ledger_invariant.hpp"
+#include "mc_enum_types.hpp"
 #include "mc_enum_types_aux.hpp" // mc_str()
 #include "miscellany.hpp"
 #include "value_cast.hpp"
@@ -309,7 +310,7 @@

     SetMonthlyDetail(eYear               ,Year);
     SetMonthlyDetail(eMonth              ,Month);
-    SetMonthlyDetail(eBasis              ,mc_str(RunBasis_));
+    SetMonthlyDetail(eBasis              ,mce_run_basis(RunBasis_).str());
     SetMonthlyDetail(eAge                ,InvariantValues().Age + Year);

     // Initial values at beginning of run, reflecting inforce if applicable.
@@ -343,7 +344,7 @@

     SetMonthlyDetail(eRegLoanBal         ,RegLnBal                         );
     SetMonthlyDetail(ePrefLoanBal        ,PrfLnBal                         );
-    SetMonthlyDetail(eDBOption           ,mc_str(YearsDBOpt)               );
+    SetMonthlyDetail(eDBOption           ,mce_dbopt(YearsDBOpt).str()      );
     SetMonthlyDetail(eSpecAmt            ,ActualSpecAmt                    );
     SetMonthlyDetail(eCorridorFactor     ,YearsCorridorFactor              );
     SetMonthlyDetail(eDeathBft           ,DBReflectingCorr                 );

reply via email to

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