lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/005 b835c6d 2/9: Partially revert the last c


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/005 b835c6d 2/9: Partially revert the last commit
Date: Wed, 20 Jan 2021 00:51:31 -0500 (EST)

branch: valyuta/005
commit b835c6d998be4dc78bdd076e00f4ec507730728f
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Partially revert the last commit
    
    Undid changes to 'currency.hpp' but not to 'round_to.hpp', and updated
    'Speed*'. The same guidelines:
    https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-complete
    say
      bool operator==(const Minimal&, const Minimal&);
    which might be read as making an exception for operator functions; but
    the real reason is that faster is better than slower, if the slight
    measured difference is credible, else that unconventional and not faster
    is not better than conventional.
---
 Speed_gcc_i686-w64-mingw32    | 12 ++++++------
 Speed_gcc_x86_64-pc-linux-gnu | 12 ++++++------
 Speed_gcc_x86_64-w64-mingw32  | 12 ++++++------
 currency.hpp                  | 34 +++++++++++++++++-----------------
 4 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/Speed_gcc_i686-w64-mingw32 b/Speed_gcc_i686-w64-mingw32
index 1a9bf4c..6ea65e3 100644
--- a/Speed_gcc_i686-w64-mingw32
+++ b/Speed_gcc_i686-w64-mingw32
@@ -1,7 +1,7 @@
 Test speed:
-  naic, no solve      : 5.456e-02 s mean;      53445 us least of  19 runs
-  naic, specamt solve : 1.045e-01 s mean;      99974 us least of  10 runs
-  naic, ee prem solve : 9.203e-02 s mean;      90746 us least of  11 runs
-  finra, no solve     : 1.682e-02 s mean;      16372 us least of  60 runs
-  finra, specamt solve: 6.793e-02 s mean;      59843 us least of  15 runs
-  finra, ee prem solve: 5.659e-02 s mean;      54196 us least of  18 runs
+  naic, no solve      : 5.632e-02 s mean;      53206 us least of  18 runs
+  naic, specamt solve : 1.124e-01 s mean;      99068 us least of   9 runs
+  naic, ee prem solve : 9.087e-02 s mean;      90032 us least of  12 runs
+  finra, no solve     : 1.740e-02 s mean;      16281 us least of  58 runs
+  finra, specamt solve: 5.861e-02 s mean;      58086 us least of  18 runs
+  finra, ee prem solve: 5.407e-02 s mean;      53546 us least of  19 runs
diff --git a/Speed_gcc_x86_64-pc-linux-gnu b/Speed_gcc_x86_64-pc-linux-gnu
index 8d93344..f51edd2 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      : 2.098e-02 s mean;      20150 us least of  48 runs
-  naic, specamt solve : 3.686e-02 s mean;      36555 us least of  28 runs
-  naic, ee prem solve : 3.372e-02 s mean;      33271 us least of  30 runs
-  finra, no solve     : 5.899e-03 s mean;       5760 us least of 100 runs
-  finra, specamt solve: 2.090e-02 s mean;      20547 us least of  48 runs
-  finra, ee prem solve: 1.930e-02 s mean;      18972 us least of  52 runs
+  naic, no solve      : 2.279e-02 s mean;      20333 us least of  44 runs
+  naic, specamt solve : 4.035e-02 s mean;      37009 us least of  25 runs
+  naic, ee prem solve : 3.971e-02 s mean;      33669 us least of  26 runs
+  finra, no solve     : 6.329e-03 s mean;       5841 us least of 100 runs
+  finra, specamt solve: 2.332e-02 s mean;      20978 us least of  43 runs
+  finra, ee prem solve: 2.022e-02 s mean;      19156 us least of  50 runs
diff --git a/Speed_gcc_x86_64-w64-mingw32 b/Speed_gcc_x86_64-w64-mingw32
index 0e1ef2e..85abe1f 100644
--- a/Speed_gcc_x86_64-w64-mingw32
+++ b/Speed_gcc_x86_64-w64-mingw32
@@ -1,7 +1,7 @@
 Test speed:
-  naic, no solve      : 3.128e-02 s mean;      27432 us least of  32 runs
-  naic, specamt solve : 4.865e-02 s mean;      47049 us least of  21 runs
-  naic, ee prem solve : 4.766e-02 s mean;      43150 us least of  22 runs
-  finra, no solve     : 1.130e-02 s mean;      10306 us least of  89 runs
-  finra, specamt solve: 3.318e-02 s mean;      28502 us least of  31 runs
-  finra, ee prem solve: 2.663e-02 s mean;      26056 us least of  38 runs
+  naic, no solve      : 3.173e-02 s mean;      28045 us least of  32 runs
+  naic, specamt solve : 4.890e-02 s mean;      47947 us least of  21 runs
+  naic, ee prem solve : 4.463e-02 s mean;      43659 us least of  23 runs
+  finra, no solve     : 1.087e-02 s mean;      10383 us least of  92 runs
+  finra, specamt solve: 2.939e-02 s mean;      28657 us least of  35 runs
+  finra, ee prem solve: 2.732e-02 s mean;      26606 us least of  37 runs
diff --git a/currency.hpp b/currency.hpp
index 9b1856f..bdd5c4b 100644
--- a/currency.hpp
+++ b/currency.hpp
@@ -54,8 +54,8 @@ class LMI_SO currency
     currency() = default;
     explicit currency(data_type z, raw_cents) : m_ {z} {}
 
-    currency& operator+=(currency z) {m_ += z.m_; return *this;}
-    currency& operator-=(currency z) {m_ -= z.m_; return *this;}
+    currency& operator+=(currency const& z) {m_ += z.m_; return *this;}
+    currency& operator-=(currency const& z) {m_ -= z.m_; return *this;}
 
     currency& operator*=(int             z) {m_ *= z   ; return *this;}
 
@@ -67,40 +67,40 @@ class LMI_SO currency
     data_type m_ = {};
 };
 
-inline bool operator==(currency lhs, currency rhs)
+inline bool operator==(currency const& lhs, currency const& rhs)
     {return lhs.cents() == rhs.cents();}
-inline bool operator< (currency lhs, currency rhs)
+inline bool operator< (currency const& lhs, currency const& rhs)
     {return lhs.cents() <  rhs.cents();}
-inline bool operator!=(currency lhs, currency rhs)
+inline bool operator!=(currency const& lhs, currency const& rhs)
     {return !operator==(lhs, rhs);}
-inline bool operator> (currency lhs, currency rhs)
+inline bool operator> (currency const& lhs, currency const& rhs)
     {return  operator< (rhs, lhs);}
-inline bool operator<=(currency lhs, currency rhs)
+inline bool operator<=(currency const& lhs, currency const& rhs)
     {return !operator> (lhs, rhs);}
-inline bool operator>=(currency lhs, currency rhs)
+inline bool operator>=(currency const& lhs, currency const& rhs)
     {return !operator< (lhs, rhs);}
 
-inline currency operator-(currency z)
+inline currency operator-(currency const& z)
     {return currency(-z.cents(), raw_cents {});}
 
-inline currency operator+(currency lhs, currency rhs)
+inline currency operator+(currency const& lhs, currency const& rhs)
     {return currency {lhs} += rhs;}
-inline currency operator-(currency lhs, currency rhs)
+inline currency operator-(currency const& lhs, currency const& rhs)
     {return currency {lhs} -= rhs;}
 
-inline currency operator*(currency lhs, int rhs)
+inline currency operator*(currency const& lhs, int rhs)
     {return currency {lhs} *= rhs;}
-inline currency operator*(int lhs, currency rhs)
+inline currency operator*(int lhs, currency const& rhs)
     {return currency {rhs} *= lhs;}
 
-inline double operator*(currency lhs, double rhs)
+inline double operator*(currency const& lhs, double rhs)
     {return lhs.d() * rhs;}
-inline double operator*(double lhs, currency rhs)
+inline double operator*(double lhs, currency const& rhs)
     {return lhs * rhs.d();}
-inline double operator/(currency lhs, double rhs)
+inline double operator/(currency const& lhs, double rhs)
     {return lhs.d() / rhs;}
 
-inline std::ostream& operator<<(std::ostream& os, currency z)
+inline std::ostream& operator<<(std::ostream& os, currency const& z)
     {return os << z.d();}
 
 inline std::vector<double> doubleize(std::vector<currency> const& z)



reply via email to

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