Snoop: improve allocation benchmarks for update operations
Context
This MR introduces 2 fixes to improve the accuracy of the allocation benchmarks for (Map|BigMap)_update benchmarks (introduced in !9765 (merged)) and N_KMap_(enter|exit)_body benchmarks (introduced in !9824 (merged)).
- As the workloads for the
(Map|BigMap)_updatebenchmarks, a key which is already included in the map was used. This is no problem for the time benchmarks, but for the allocation benchmarks, such update allocates no nodes thus the measured memory usage was improperly small. So this MR changes to use a key not included in the map so that some nodes are allocated when update. - This MR introduces
contfield when measuring words so that the parameters of theN_KMap_(enter|exit)_bodyallocation models change to what they ought to be.
Result.fold
~error:(fun _ -> 0.0)
~ok:(fun (stack_top, stack, _, _) ->
let size_after =
- Obj.reachable_words (Obj.repr (stack_top, stack, bef_top, bef))
+ Obj.reachable_words (Obj.repr (stack_top, stack, bef_top, bef, cont))
in
let size_before =
- Obj.reachable_words (Obj.repr (bef_top, bef, bef_top, bef))
+ Obj.reachable_words (Obj.repr (bef_top, bef, bef_top, bef, cont))
in
Manually testing the MR
Measuring command:
./octez-snoop generate code for models interpreter/N_IMap_get_synthesized interpreter/N_IMap_update_synthesized interpreter/N_IBig_map_get_synthesized interpreter/N_IBig_map_update_synthesized interpreter/N_IMap_get_and_update_synthesized interpreter/N_IBig_map_get_and_update_synthesized interpreter/N_KNil_synthesized interpreter/N_KCons_synthesized interpreter/N_KReturn_synthesized interpreter/N_KView_exit_synthesized interpreter/N_KMap_head_synthesized interpreter/N_KUndip_synthesized interpreter/N_KLoop_in_synthesized interpreter/N_KLoop_in_left_synthesized interpreter/N_KIter_empty_synthesized interpreter/N_KIter_nonempty_synthesized interpreter/N_KList_enter_body_synthesized interpreter/N_KList_exit_body_synthesized interpreter/N_KMap_enter_body_synthesized interpreter/N_KMap_exit_body_synthesized --out-dir outXXX
Note that the execution times changed little.
1. The alloc_coeff parameters now reflects the worst case of the insertion to the AVL tree.
Measured on this MR
< interpreter/N_IBig_map_get_and_update_alloc_coeff = 6.15136100373
< interpreter/N_IBig_map_get_and_update_alloc_const = 45.9424388916
< interpreter/N_IBig_map_update_alloc_coeff = 6.24992521212
< interpreter/N_IBig_map_update_alloc_const = 42.243857091
< interpreter/N_IMap_get_and_update_alloc_coeff = 6.96891314968
< interpreter/N_IMap_get_and_update_alloc_const = 26.9425638192
< interpreter/N_IMap_update_alloc_coeff = 6.91987861597
< interpreter/N_IMap_update_alloc_const = 22.5154103276
c.f. measured on the current master branch.
> interpreter/N_IBig_map_get_and_update_alloc_coeff = 1.33400637691
> interpreter/N_IBig_map_get_and_update_alloc_const = 63.549511246
> interpreter/N_IBig_map_update_alloc_coeff = 1.3621417845
> interpreter/N_IBig_map_update_alloc_const = 61.3009529197
> interpreter/N_IMap_get_and_update_alloc_coeff = 0.21332277337
> interpreter/N_IMap_get_and_update_alloc_const = 8.26202445283
> interpreter/N_IMap_update_alloc_coeff = 0
> interpreter/N_IMap_update_alloc_const = 4
Graphs
Previous graphs were at !9765 (merged)
2. The constants of the KMap_ alloc parameters are improved due to passing the cont at the measurement.
Measured on this MR
< interpreter/N_KMap_enter_body_alloc_empty = 2
interpreter/N_KMap_enter_body_alloc_nonempty = 0
< interpreter/N_KMap_exit_body_alloc_coeff = 7.44359352882
< interpreter/N_KMap_exit_body_alloc_const = 15.5558623963
c.f. measured on the current master branch.
> interpreter/N_KMap_enter_body_alloc_empty = 61
interpreter/N_KMap_enter_body_alloc_nonempty = 0
> interpreter/N_KMap_exit_body_alloc_coeff = 7.98755584903
> interpreter/N_KMap_exit_body_alloc_const = 4424670.33686
Graphs
Previous graphs were at !9824 (merged)
Checklist
-
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Jun Furuse




