diff --git a/Makefile b/Makefile index adaabdb..4b031cf 100644 --- a/Makefile +++ b/Makefile @@ -31,13 +31,18 @@ clean-test-btrees: plt: compile $(DIALYZER) --build_plt --output_plt .hanoi.plt \ -pa deps/snappy/ebin \ + -pa deps/snappy/ebin \ + -pa deps/lz4/ebin \ + -pa deps/ebloom/ebin \ -pa deps/plain_fsm/ebin \ deps/plain_fsm/ebin \ - --apps kernel stdlib + --apps erts kernel stdlib ebloom lz4 snappy analyze: compile $(DIALYZER) --plt .hanoi.plt \ -pa deps/snappy/ebin \ + -pa deps/lz4/ebin \ + -pa deps/ebloom/ebin \ -pa deps/plain_fsm/ebin \ ebin diff --git a/src/gb_trees_ext.erl b/src/gb_trees_ext.erl index 376c29e..7efc6d4 100644 --- a/src/gb_trees_ext.erl +++ b/src/gb_trees_ext.erl @@ -5,7 +5,7 @@ % author: http://erlang.2086793.n4.nabble.com/gb-trees-fold-td2228614.html --spec fold(fun((term(), term(), term()) -> term()), term(), gb_tree()) -> term(). +-spec fold(fun((term(), term(), term()) -> term()), term(), gb_trees:tree()) -> term(). fold(F, A, {_, T}) when is_function(F, 3) -> fold_1(F, A, T). diff --git a/test/hanoidb_writer_tests.erl b/test/hanoidb_writer_tests.erl index f01ac20..a8706e6 100644 --- a/test/hanoidb_writer_tests.erl +++ b/test/hanoidb_writer_tests.erl @@ -62,9 +62,9 @@ simple_test() -> simple1_test() -> file:delete("testdata"), - {ok, BT} = hanoidb_writer:open("testdata", [{block_size, 1024},{expiry_secs, 0}]), + {ok, BT} = hanoidb_writer:open("testdata", [{block_size, 102},{expiry_secs, 0}]), - Max = 1024, + Max = 102, Seq = lists:seq(0, Max), {Time1,_} = timer:tc( @@ -78,15 +78,16 @@ simple1_test() -> end, []), -% error_logger:info_msg("time to insert: ~p/sec~n", [1000000/(Time1/Max)]), + error_logger:info_msg("time to insert: ~p/sec~n", [1000000/(Time1/Max)]), {ok, IN} = hanoidb_reader:open("testdata", [{expiry_secs,0}]), Middle = Max div 2, + io:format("LOOKING UP ~p~n", [<>]), {ok, <<"valuevalue/", Middle:128>>} = hanoidb_reader:lookup(IN, <>), {Time2,Count} = timer:tc( - fun() -> hanoidb_reader:fold(fun(Key, <<"valuevalue/", Key/binary>>, N) -> + fun() -> hanoidb_reader:fold(fun(_Key, <<"valuevalue/", N:128>>, N) -> N+1 end, 0, @@ -94,12 +95,13 @@ simple1_test() -> end, []), -% error_logger:info_msg("time to scan: ~p/sec~n", [1000000/(Time2/Max)]), + io:format("time to scan: ~p/sec~n", [1000000/(Time2 div Max)]), Max = Count-1, {Time3,{done,Count2}} = timer:tc( - fun() -> hanoidb_reader:range_fold(fun(Key, <<"valuevalue/", Key/binary>>, N) -> + fun() -> hanoidb_reader:range_fold(fun(_Key, <<"valuevalue/", N:128>>, N) -> +% io:format("[~p]~n", N), N+1 end, 0, @@ -108,9 +110,11 @@ simple1_test() -> end, []), -% error_logger:info_msg("time to range_fold: ~p/sec~n", [1000000/(Time3/Max)]), -% error_logger:info_msg("count2=~p~n", [Count2]), + + %error_logger:info_msg("time to range_fold: ~p/sec~n", [1000000/(Time3 div Max)]), + + io:format("count2=~p~n", [Count2]), Max = Count2-1,