This commit is contained in:
Gregory Travis 2024-05-30 11:53:36 -04:00
parent 5376341961
commit 006478ea8b

View File

@ -38,7 +38,6 @@ public class VectorBenchmarks {
import Standard.Base.Data.Vector.Builder
import Standard.Base.Data.Vector.Vector
import Standard.Base.Data.Array_Proxy.Array_Proxy
from Standard.Base.Data.Boolean import False
avg arr =
sum acc i = if i == arr.length then acc else
@ -46,15 +45,15 @@ public class VectorBenchmarks {
(sum 0 0) / arr.length
fibarr size modulo =
Vector.build initial_capacity=size propagate_warnings=False b->
b.append 1
b.append 1
b = Builder.new size
b.append 1
b.append 1
add_more n = if n == size then b else
b.append <| (b.at n-1 + b.at n-2) % modulo
@Tail_Call add_more n+1
add_more n = if n == size then b else
b.append <| (b.at n-1 + b.at n-2) % modulo
@Tail_Call add_more n+1
add_more 2
add_more 2 . to_vector
to_vector arr = Vector.from_polyglot_array arr
to_array vec = vec.to_array