Measure changed-key work on large collections
This commit is contained in:
6 files changed
+252
-7
No files matched your search
@@ -856,3 +856,42 @@ let differential_cases =
|
||||
( "the incremental plan matches full evaluation on a short run",
|
||||
fun () -> differential_case 5 20 );
|
||||
]
|
||||
|
||||
let regression_cases =
|
||||
[
|
||||
( "a single key update on a large collection touches only that key",
|
||||
fun () ->
|
||||
let entries =
|
||||
Util.list_init 500 (fun index -> (index + 1, order_row (Printf.sprintf "customer%d" index) ((index * 37) mod 4001)))
|
||||
in
|
||||
let fixture = build_fixture (read_fixture "expensive_order.delta") entries in
|
||||
Delta_runtime.reset_counters fixture.fx_counters;
|
||||
(match step fixture [ Change.OpReplace (250, order_row "customer250" 3000) ] with
|
||||
| Error message -> fail "update" message
|
||||
| Ok (applied, cached, _) ->
|
||||
let counters = fixture.fx_counters in
|
||||
check_equal_int "predicate evaluations" 1 counters.Delta_runtime.predicate_evaluations;
|
||||
check_equal_int "mapping evaluations" 0 counters.Delta_runtime.mapping_evaluations;
|
||||
check_equal_int "scalar deltas" 1 counters.Delta_runtime.scalar_deltas;
|
||||
check_equal_int "changed key visits" 3 counters.Delta_runtime.changed_key_visits;
|
||||
check_equal_int "full traversals" 0 counters.Delta_runtime.full_traversals;
|
||||
check_equal_string "result matches the reference"
|
||||
(Value.to_string (reference_result fixture fixture.fx_state))
|
||||
(Value.to_string applied);
|
||||
check_equal_string "cache matches the reference"
|
||||
(Value.to_string (reference_result fixture fixture.fx_state))
|
||||
(Value.to_string cached)) );
|
||||
( "an inserted key only evaluates the predicate and mapping for itself",
|
||||
fun () ->
|
||||
let entries = Util.list_init 500 (fun index -> (index + 1, order_row "row" 10)) in
|
||||
let fixture = build_fixture (read_fixture "expensive_order.delta") entries in
|
||||
Delta_runtime.reset_counters fixture.fx_counters;
|
||||
(match step fixture [ Change.OpInsert (501, order_row "newcomer" 5000) ] with
|
||||
| Error message -> fail "insert" message
|
||||
| Ok _ ->
|
||||
let counters = fixture.fx_counters in
|
||||
check_equal_int "predicate evaluations" 1 counters.Delta_runtime.predicate_evaluations;
|
||||
check_equal_int "mapping evaluations" 1 counters.Delta_runtime.mapping_evaluations;
|
||||
check_equal_int "changed key visits" 3 counters.Delta_runtime.changed_key_visits;
|
||||
check_equal_int "full traversals" 0 counters.Delta_runtime.full_traversals) );
|
||||
]
|
||||
Reference in new issue
Block a user