diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 15:39:23 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 15:39:23 +0100 |
| commit | 72bd993483453ed8ebc462f1a33385cd355d486f (patch) | |
| tree | c5592ba1ed2fed79e26ba6158d097c9ceb43f061 /test/math/rho.cpp | |
| parent | 98567ec798aa8ca2cfbcb85c774dd470f30e30d4 (diff) | |
| parent | 35d485bcf6a9ed0a9542628ce4aa94a3326d0884 (diff) | |
merge mzuenni changes
Diffstat (limited to 'test/math/rho.cpp')
| -rw-r--r-- | test/math/rho.cpp | 14 |
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; } |
