More benchmarks and examples.

This commit is contained in:
Stephen Chung
2020-05-31 23:44:49 +08:00
parent 331513f5e0
commit c6e5f672c9
5 changed files with 189 additions and 39 deletions

22
scripts/for2.rhai Normal file
View File

@@ -0,0 +1,22 @@
const MAX = 1_000_000;
print("Iterating an array with " + MAX + " items...");
print("Ready... Go!");
let now = timestamp();
let list = [];
for i in range(0, MAX) {
list.push(i);
}
let sum = 0;
for i in list {
sum += i;
}
print("Sum = " + sum);
print("Finished. Run time = " + now.elapsed + " seconds.");