[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 5c0fa12 1/2: Set 'badbit' on a null stream
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 5c0fa12 1/2: Set 'badbit' on a null stream |
Date: |
Fri, 6 Aug 2021 20:06:37 -0400 (EDT) |
branch: master
commit 5c0fa12013effcd1dc66fea5012c0ee22d932e1c
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Set 'badbit' on a null stream
This saves about one millisecond on every solve. It's not an enormous
optimization, but it's nearly free.
Mean speed is about one percent better than commit 5d4f50639, which was
about one percent worse than the penultimate speed test.
---
Speed_gcc_i686-w64-mingw32 | 12 ++++++------
Speed_gcc_x86_64-pc-linux-gnu | 12 ++++++------
Speed_gcc_x86_64-w64-mingw32 | 12 ++++++------
ihs_avsolve.cpp | 1 +
null_stream.cpp | 1 +
5 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/Speed_gcc_i686-w64-mingw32 b/Speed_gcc_i686-w64-mingw32
index d7adad7..ab36223 100644
--- a/Speed_gcc_i686-w64-mingw32
+++ b/Speed_gcc_i686-w64-mingw32
@@ -1,7 +1,7 @@
Test speed:
- naic, no solve : 2.260e-02 s mean; 22402 us least of 45 runs
- naic, specamt solve : 4.720e-02 s mean; 46966 us least of 22 runs
- naic, ee prem solve : 4.185e-02 s mean; 41549 us least of 24 runs
- finra, no solve : 1.097e-02 s mean; 10786 us least of 92 runs
- finra, specamt solve: 3.382e-02 s mean; 33610 us least of 30 runs
- finra, ee prem solve: 3.131e-02 s mean; 29870 us least of 32 runs
+ naic, no solve : 2.279e-02 s mean; 22115 us least of 44 runs
+ naic, specamt solve : 4.766e-02 s mean; 46581 us least of 21 runs
+ naic, ee prem solve : 4.198e-02 s mean; 41044 us least of 24 runs
+ finra, no solve : 1.185e-02 s mean; 10905 us least of 85 runs
+ finra, specamt solve: 3.430e-02 s mean; 33426 us least of 30 runs
+ finra, ee prem solve: 3.056e-02 s mean; 29940 us least of 33 runs
diff --git a/Speed_gcc_x86_64-pc-linux-gnu b/Speed_gcc_x86_64-pc-linux-gnu
index 25932db..461ad29 100644
--- a/Speed_gcc_x86_64-pc-linux-gnu
+++ b/Speed_gcc_x86_64-pc-linux-gnu
@@ -1,7 +1,7 @@
Test speed:
- naic, no solve : 1.543e-02 s mean; 14963 us least of 65 runs
- naic, specamt solve : 3.169e-02 s mean; 31265 us least of 32 runs
- naic, ee prem solve : 2.769e-02 s mean; 27259 us least of 37 runs
- finra, no solve : 5.406e-03 s mean; 5155 us least of 100 runs
- finra, specamt solve: 2.034e-02 s mean; 19903 us least of 50 runs
- finra, ee prem solve: 1.802e-02 s mean; 17762 us least of 56 runs
+ naic, no solve : 1.595e-02 s mean; 14853 us least of 63 runs
+ naic, specamt solve : 3.144e-02 s mean; 30627 us least of 32 runs
+ naic, ee prem solve : 2.755e-02 s mean; 27012 us least of 37 runs
+ finra, no solve : 5.513e-03 s mean; 5241 us least of 100 runs
+ finra, specamt solve: 2.040e-02 s mean; 20008 us least of 50 runs
+ finra, ee prem solve: 1.812e-02 s mean; 17584 us least of 56 runs
diff --git a/Speed_gcc_x86_64-w64-mingw32 b/Speed_gcc_x86_64-w64-mingw32
index 70b4004..aa15005 100644
--- a/Speed_gcc_x86_64-w64-mingw32
+++ b/Speed_gcc_x86_64-w64-mingw32
@@ -1,7 +1,7 @@
Test speed:
- naic, no solve : 2.295e-02 s mean; 21795 us least of 44 runs
- naic, specamt solve : 4.352e-02 s mean; 41654 us least of 23 runs
- naic, ee prem solve : 3.726e-02 s mean; 36902 us least of 27 runs
- finra, no solve : 9.641e-03 s mean; 9464 us least of 100 runs
- finra, specamt solve: 2.783e-02 s mean; 27509 us least of 36 runs
- finra, ee prem solve: 2.500e-02 s mean; 24710 us least of 41 runs
+ naic, no solve : 2.271e-02 s mean; 21439 us least of 45 runs
+ naic, specamt solve : 4.157e-02 s mean; 41005 us least of 25 runs
+ naic, ee prem solve : 3.697e-02 s mean; 36392 us least of 28 runs
+ finra, no solve : 1.011e-02 s mean; 9435 us least of 99 runs
+ finra, specamt solve: 2.770e-02 s mean; 27096 us least of 37 runs
+ finra, ee prem solve: 2.485e-02 s mean; 24515 us least of 41 runs
diff --git a/ihs_avsolve.cpp b/ihs_avsolve.cpp
index f1abc27..bc3c47e 100644
--- a/ihs_avsolve.cpp
+++ b/ihs_avsolve.cpp
@@ -458,6 +458,7 @@ currency AccountValue::Solve
LMI_ASSERT(nullptr != solve_set_fn);
std::ostream os_trace(&null_streambuf());
+ os_trace.setstate(std::ios::badbit);
std::ofstream ofs_trace;
if
( global_settings::instance().regression_testing()
diff --git a/null_stream.cpp b/null_stream.cpp
index 4df8a92..d48d09e 100644
--- a/null_stream.cpp
+++ b/null_stream.cpp
@@ -76,6 +76,7 @@ std::streambuf& null_streambuf()
/// therefore has a global effect that is probably unwanted.
/// Therefore, prefer to create a local object instead, e.g.:
/// std::ostream local_os(&null_streambuf());
+/// local_os.setstate(std::ios::badbit);
/// local_os << "written to oblivion";
/// local_os.rdbuf(std::cout.rdbuf); // effect is only local
/// local_os << "written to stdout";