Skip to content

Commit ba16959

Browse files
committed
test: primitive gc stress test
1 parent c06e9a6 commit ba16959

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/gc_stress.slash

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# GC stress test
2+
3+
# bunch of allocations
4+
loop i in ..100_000 {
5+
var alloced_str = "some_str_" + ($i as str)
6+
}
7+
8+
var fib_iterative = func n {
9+
var a = 0
10+
var b = 1
11+
loop _ in 1..$n+1 {
12+
var c = $a + $b
13+
$a, $b = $b, $c
14+
}
15+
return $a
16+
}
17+
18+
var fib_recursive = func n {
19+
$n <= 1 && return $n
20+
return $fib_recursive($n - 1) + $fib_recursive($n - 2)
21+
}
22+
23+
$fib_iterative(15)
24+
# multiple function calls
25+
$fib_recursive(15)
26+
27+
# pipeline
28+
var n = (ls | wc -l) as num
29+
var np2 = $n + 2

0 commit comments

Comments
 (0)