[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 29b2ad4 14/14: Measure i7702 speed
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 29b2ad4 14/14: Measure i7702 speed |
Date: |
Thu, 1 Apr 2021 18:15:18 -0400 (EDT) |
branch: master
commit 29b2ad46d009b35724f66198ab4506fd1a1823df
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Measure i7702 speed
Speed tests use input with length 99, instead of the artificially lower
lengths that suffice for other tests.
The numerous vector assertions are demonstrably affordable.
---
i7702_test.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
objects.make | 1 +
2 files changed, 68 insertions(+), 2 deletions(-)
diff --git a/i7702_test.cpp b/i7702_test.cpp
index fa27d10..2af80dd 100644
--- a/i7702_test.cpp
+++ b/i7702_test.cpp
@@ -25,6 +25,7 @@
#include "materially_equal.hpp"
#include "test_tools.hpp"
+#include "timer.hpp"
class i7702_test
{
@@ -33,17 +34,24 @@ class i7702_test
{
test0();
test1();
+ assay_speed();
}
private:
static i7702 bland0();
static i7702 bland1();
+ static i7702 bland99();
static void test0();
static void test1();
+ static void assay_speed();
+
+ static void mete_construct();
+ static void mete_initialize();
+ static void mete_assert();
};
-/// Bland initial values, not varying by duration; Em rounded down.
+/// Bland initial values: a single duration; Em rounded down.
i7702 i7702_test::bland0()
{
@@ -71,7 +79,7 @@ i7702 i7702_test::bland0()
};
}
-/// Bland initial values, varying by duration; Em rounded up.
+/// Bland initial values: two durations; Em rounded up.
i7702 i7702_test::bland1()
{
@@ -99,6 +107,35 @@ i7702 i7702_test::bland1()
};
}
+/// Bland initial values: ninety-nine durations; Em rounded up.
+
+i7702 i7702_test::bland99()
+{
+ constexpr int length {99};
+ return i7702
+ (length // length
+ ,0.04 // A0
+ ,0.06 // A1
+ ,std::vector<double>(length, 0.03 ) // Bgen
+ ,std::vector<double>(length, 0.00 ) // Bsep
+ ,std::vector<double>(length, 0.02 ) // Bflr
+ ,std::vector<double>(length, 0.02 ) // Bvlr
+ ,std::vector<double>(length, 0.00 ) // Cgen
+ ,std::vector<double>(length, 0.00 ) // Csep
+ ,std::vector<double>(length, 0.00 ) // Cflr
+ ,std::vector<double>(length, 0.00 ) // Cvlr
+ ,std::vector<double>(length, 0.00 ) // Dgen
+ ,std::vector<double>(length, 0.00 ) // Dsep
+ ,std::vector<double>(length, 0.00 ) // Dflr
+ ,std::vector<double>(length, 0.00 ) // Dvlr
+ ,std::vector<double>(length, 0.0032738) // Em
+ ,std::vector<double>(length, 1.0 ) // use_gen
+ ,std::vector<double>(length, 1.0 ) // use_sep
+ ,std::vector<double>(length, 1.0 ) // use_flr
+ ,std::vector<double>(length, 1.0 ) // use_vlr
+ );
+}
+
void i7702_test::test0()
{
i7702 z {bland0()};
@@ -127,6 +164,34 @@ void i7702_test::test1()
LMI_TEST(materially_equal(0.0032738 , z.ig_usual()[1]));
}
+void i7702_test::assay_speed()
+{
+ std::cout
+ << "\n Speed tests..."
+ << "\n Construct : " << TimeAnAliquot(mete_construct)
+ << "\n Initialize: " << TimeAnAliquot(mete_initialize)
+ << "\n Assert : " << TimeAnAliquot(mete_assert)
+ << std::endl
+ ;
+}
+
+void i7702_test::mete_construct()
+{
+ i7702 z {bland99()};
+}
+
+void i7702_test::mete_initialize()
+{
+ static i7702 z {bland99()};
+ z.initialize();
+}
+
+void i7702_test::mete_assert()
+{
+ static i7702 z {bland99()};
+ z.assert_preconditions();
+}
+
int test_main(int, char*[])
{
i7702_test::test();
diff --git a/objects.make b/objects.make
index 7739cf6..9bc6b81 100644
--- a/objects.make
+++ b/objects.make
@@ -690,6 +690,7 @@ i7702_test$(EXEEXT): \
$(common_test_objects) \
i7702.o \
i7702_test.o \
+ timer.o \
ieee754_test$(EXEEXT): \
$(common_test_objects) \
- [lmi-commits] [lmi] master c309291 02/14: Factor out precondition assertions, (continued)
- [lmi-commits] [lmi] master c309291 02/14: Factor out precondition assertions, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 218e02a 03/14: Reflect short-term guarantees in 7702 interest rates, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 2d10858 06/14: Use DB_AnnIntRateGspDelta instead of hard-coding two percent, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 8a9085a 08/14: Reflect DB_GenAcctIntBonus in 7702 interest, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 836c6f9 09/14: Refactor unit test, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 637f0de 12/14: Reorder unit-test functions, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master c291b59 05/14: Assert more preconditions, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master cb16682 10/14: Make i7702 vector assignments idempotent, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 8723736 11/14: Make bland1() truly bland, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 36266d1 13/14: Don't echo unneeded values in unit test, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 29b2ad4 14/14: Measure i7702 speed,
Greg Chicares <=
- [lmi-commits] [lmi] master ad538f7 07/14: Fix defect introduced 20210314T2207Z: wrong VLR, Greg Chicares, 2021/04/01
- [lmi-commits] [lmi] master 26db3ec 04/14: Move an assertion upstream, and generalize it, Greg Chicares, 2021/04/01