aboutsummaryrefslogtreecommitdiff
path: root/tests/programs/bench_strings.zc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/programs/bench_strings.zc')
-rw-r--r--tests/programs/bench_strings.zc21
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/programs/bench_strings.zc b/tests/programs/bench_strings.zc
index 455cff9..6f224db 100644
--- a/tests/programs/bench_strings.zc
+++ b/tests/programs/bench_strings.zc
@@ -1,27 +1,30 @@
+namespace;
+include rt;
+
fn work() {
let s = b"abcdefghijklmnopqrstuvwxyz0123456789";
let i, acc, n, t, part, k, reps, ch;
- ch = get_c();
+ ch = rt.get_c();
reps = 0;
- while (ch >= '0' && ch <= '9') { reps = reps * 10 + ch - '0'; ch = get_c(); }
+ while (ch >= '0' && ch <= '9') { reps = reps * 10 + ch - '0'; ch = rt.get_c(); }
while (reps > 0) {
- k = 0; acc = 0; n = len_s(s);
+ k = 0; acc = 0; n = rt.len_s(s);
while (k < 200) {
i = 0;
- while (i < n) { acc = acc + at_s(s, i); i++; }
+ while (i < n) { acc = acc + rt.at_s(s, i); i++; }
k++;
}
t = s + b"!";
part = t[1:8];
- acc = acc + len_s(t) + len_s(part) + at_s(part, 0);
- free(part);
- free(t);
+ acc = acc + rt.len_s(t) + rt.len_s(part) + rt.at_s(part, 0);
+ rt.free(part);
+ rt.free(t);
reps--;
}
return acc;
}
fn main() {
- put_n(work());
- put_c(10);
+ rt.put_n(work());
+ rt.put_c(10);
return 0;
}