summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2024-07-30 15:57:54 +0200
committermzuenni <michi.zuendorf@gmail.com>2024-07-30 15:57:54 +0200
commitef95a81b809ec6fcaf53a870f7bc86bf613b42f8 (patch)
treed459e341e0cc2b61b6bca3466d79e3c5ff569bb3 /test
parent8d11c6c8213f46f0fa19826917c255edd5d43cb1 (diff)
removed old slow code
Diffstat (limited to 'test')
-rw-r--r--test/math/rho.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/math/rho.cpp b/test/math/rho.cpp
index 5e4792a..941524b 100644
--- a/test/math/rho.cpp
+++ b/test/math/rho.cpp
@@ -96,17 +96,25 @@ void stress_test() {
cerr << "stress tested: " << t.time << "ms" << endl;
}
-constexpr int N = 2'000;
+ll randomHard(ll lim) {
+ ll root2 = sqrt(lim);
+ ll root3 = cbrt(lim);
+ ll a = Random::prime<ll>(root2 / 2 - root3, root2 / 2 + root3);
+ ll b = Random::prime<ll>(lim / a - root3, lim / a);
+ return a * b;
+}
+
+constexpr int N = 200;
void performance_test() {
timer t;
hash_t hash = 0;
for (int operations = 0; operations < N; operations++) {
- ll x = Random::integer<ll>(1e18 / 2, 1e18);
+ ll x = randomHard(1e18);
t.start();
hash += factor(x).size();
t.stop();
}
- if (t.time > 500) cerr << "too slow: " << t.time << FAIL;
+ if (t.time > 750) cerr << "too slow: " << t.time << FAIL;
cerr << "tested performance: " << t.time << "ms (hash: " << hash << ")" << endl;
}