Share final timing test

This commit is contained in:
martinsumner 2016-12-23 23:30:15 +00:00
parent 2d08816445
commit 0cea470b70

View file

@ -164,8 +164,13 @@ simple_slotbin_test() ->
lookup_in_slot(K, SlotBin0)) lookup_in_slot(K, SlotBin0))
end, end,
KVList1), KVList1),
io:format(user, "Slot checked for all keys in ~w microsconds~n", io:format(user, "Slot checked for all keys in ~w microseconds~n",
[timer:now_diff(os:timestamp(), SW1)]), [timer:now_diff(os:timestamp(), SW1)]),
SW5 = os:timestamp(),
leveled_skiplist:to_list(binary_to_term(SlotBin0)),
io:format(user, "Skiplist flattened in ~w microseconds~n",
[timer:now_diff(os:timestamp(), SW5)]),
io:format(user, "~ngb_tree comparison~n", []), io:format(user, "~ngb_tree comparison~n", []),
SW2 = os:timestamp(), SW2 = os:timestamp(),
@ -174,16 +179,21 @@ simple_slotbin_test() ->
HashList), HashList),
Tree0 = gb_trees:from_orddict(KVList1), Tree0 = gb_trees:from_orddict(KVList1),
TreeBin = term_to_binary(Tree0, [{compressed, ?COMPRESSION_LEVEL}]), TreeBin = term_to_binary(Tree0, [{compressed, ?COMPRESSION_LEVEL}]),
io:format(user, "Bloom and Tree created for all keys in ~w microsconds~n", io:format(user, "Bloom and Tree created for all keys in ~w microseconds " ++
[timer:now_diff(os:timestamp(), SW2)]), "with size ~w~n",
[timer:now_diff(os:timestamp(), SW2), byte_size(TreeBin)]),
SW3 = os:timestamp(), SW3 = os:timestamp(),
lists:foreach(fun({K, V}) -> lists:foreach(fun({K, V}) ->
?assertMatch({value, V}, ?assertMatch({value, V},
gb_trees:lookup(K, binary_to_term(TreeBin))) gb_trees:lookup(K, binary_to_term(TreeBin)))
end, end,
KVList1), KVList1),
io:format(user, "Tree checked for all keys in ~w microsconds~n", io:format(user, "Tree checked for all keys in ~w microseconds~n",
[timer:now_diff(os:timestamp(), SW3)]). [timer:now_diff(os:timestamp(), SW3)]),
SW4 = os:timestamp(),
gb_trees:to_list(binary_to_term(TreeBin)),
io:format(user, "Tree flattened in ~w microseconds~n",
[timer:now_diff(os:timestamp(), SW4)]).
-endif. -endif.