By the defer calculating sorted values we gaining speed on multiply numbers insert.
google translate: using a deferred calculation, we've increased the speed of insertion of several numbers in succession
By the defer calculating sorted values we gaining speed on multiply numbers insert.
google translate: using a deferred calculation, we've increased the speed of insertion of several numbers in succession
Time of comparison proportional length of shorter argument. Less
operations on cycle. (Removing weight % operation).
By the defer `rendering` of sorted values we gaining speed on multiply
numbers insert.
Maybe, someone need to use sorted().size(), for that, he dont need
copying constructor
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/ee78b6c5292a6613d33223761c9a2548d936bd77 for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.
NACK on the TimingResistantEqual optimization-- new version lets an attacker determine the length of the password.
RE: optimizations in general: NACK unless you have a use case where performance matters. If you do, then please share what is sped up, and by how much.
Got it. What about my commentary about the reset of the median filter. Is this a bug?
CMedianFilter works correctly for me (patch for the median filter unit test):
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp
index abfd882..be4b2d3 100644
--- a/src/test/util_tests.cpp
+++ b/src/test/util_tests.cpp
@@ -32,6 +32,12 @@ BOOST_AUTO_TEST_CASE(util_criticalsection)
BOOST_AUTO_TEST_CASE(util_MedianFilter)
{
+ CMedianFilter<int> filter2(2, 0);
+ BOOST_CHECK_EQUAL(filter2.median(), 0);
+ filter2.input(10);
+ filter2.input(20);
+ BOOST_CHECK_EQUAL(filter2.median(), 15);
+
CMedianFilter<int> filter(5, 15);
BOOST_CHECK_EQUAL(filter.median(), 15);
The median filter is only used on new connections and is used with very small filter sizes. It's deliberately very simple in implementation.