Skip to content

Commit

Permalink
Benchmark up_to . each (#11848)
Browse files Browse the repository at this point in the history
Benchmark for #5355. Seems to be fast.
  • Loading branch information
JaroslavTulach authored Dec 12, 2024
1 parent 1a8888d commit fe5e134
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/Benchmarks/src/Numeric.enso
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from Standard.Base import all
import Standard.Base.Runtime.Ref.Ref

from Standard.Test import Bench, Faker
from Standard.Base.Runtime import assert


options = Bench.options . set_warmup (Bench.phase_conf 1 3) . set_measure (Bench.phase_conf 1 3)
Expand Down Expand Up @@ -47,6 +49,16 @@ collect_benches = Bench.build builder->
group_builder.specify ("float_" + name) (data.floats.map fun)
group_builder.specify ("integer_" + name) (data.integers.map fun)

up_to_options = Bench.options . set_warmup (Bench.phase_conf 5 2) . set_measure (Bench.phase_conf 3 2)

builder.group "Numeric_Up_To" up_to_options group_builder->
group_builder.specify "counting_up_to_1000000" <|
cell = Ref.new 0
n = 100000000
0.up_to n . each _->
x = cell.get
cell.put x+1
assert cell.get==n "Expecting "+n.to_text+" but was "+cell.get.to_text

## Creates a valid name for the benchmark
create_name : Text -> Integer -> Boolean -> Text
Expand Down

0 comments on commit fe5e134

Please sign in to comment.