Add timestamp support.

This commit is contained in:
Stephen Chung
2020-04-11 16:06:57 +08:00
parent d73cfb6da5
commit 5848339d5a
7 changed files with 223 additions and 103 deletions

View File

@@ -1,5 +1,7 @@
// This script uses the Sieve of Eratosthenes to calculate prime numbers.
let now = timestamp();
const MAX_NUMBER_TO_CHECK = 10_000; // 1229 primes <= 10000
let prime_mask = [];
@@ -24,3 +26,4 @@ for p in range(2, MAX_NUMBER_TO_CHECK) {
}
print("Total " + total_primes_found + " primes.");
print("Run time = " + now.elapsed() + " seconds.");

View File

@@ -1,6 +1,7 @@
// This script runs 1 million iterations
// to test the speed of the scripting engine.
let now = timestamp();
let x = 1_000_000;
print("Ready... Go!");
@@ -9,4 +10,4 @@ while x > 0 {
x = x - 1;
}
print("Finished.");
print("Finished. Run time = " + now.elapsed() + " seconds.");