From b468b77a9c0c9b40abf5c828727330607a967a55 Mon Sep 17 00:00:00 2001 From: Matthew Griffith Date: Tue, 28 Jul 2020 23:29:39 -0400 Subject: [PATCH] add record updates to benching example --- testcases/bench/Main.elm | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/testcases/bench/Main.elm b/testcases/bench/Main.elm index 71388ba..fdec700 100644 --- a/testcases/bench/Main.elm +++ b/testcases/bench/Main.elm @@ -37,17 +37,35 @@ addMyType mine sum = sum +type alias MyRecord = + { one : Int + , two : Int + , three : Int + + } + main : BenchmarkProgram main = Benchmark.Runner.program suite +updateRecord attr record = + { record | one = 87 } + suite : Benchmark suite = - describe "List of MyType" - [ -- nest as many descriptions as you like - describe "slice" - [ benchmark "sum 1000 entities in a list" <| + describe "Benchmarks" + [ + benchmark "sum 1000 entities in a list" <| \_ -> List.foldl addMyType 0 many - ] + + , benchmark "1000 record updates" <| + \_ -> List.foldl updateRecord + { one = 1 + , two = 2 + , three = 3 + + } + + many ]