Add fast operators to benchmarks.

This commit is contained in:
Stephen Chung
2022-09-03 15:48:00 +08:00
parent b3f6fa9ce8
commit 1ae0a4c761
4 changed files with 6505 additions and 7 deletions

6480
scripts/all_in_one.d.rhai Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,8 @@
let now = timestamp();
const MAX_NUMBER_TO_CHECK = 1_000_000; // 9592 primes <= 100000
const ANSWER = 78_498;
const MAX_NUMBER_TO_CHECK = 1_000_000;
let prime_mask = [];
prime_mask.pad(MAX_NUMBER_TO_CHECK + 1, true);
@@ -27,6 +28,6 @@ for p in 2..=MAX_NUMBER_TO_CHECK {
print(`Total ${total_primes_found} primes <= ${MAX_NUMBER_TO_CHECK}`);
print(`Run time = ${now.elapsed} seconds.`);
if total_primes_found != 78_498 {
print("The answer is WRONG! Should be 78,498!");
if total_primes_found != ANSWER {
print(`The answer is WRONG! Should be ${ANSWER}!`);
}