zip stored bloom filter
This commit is contained in:
parent
5af86b9e23
commit
da65b9abb1
3 changed files with 4 additions and 4 deletions
|
@ -17,7 +17,7 @@ open(Name) ->
|
|||
{ok, <<BloomSize:32/unsigned>>} = file:pread(File, FileInfo#file_info.size-12, 4),
|
||||
{ok, BloomData} = file:pread(File, FileInfo#file_info.size-12-BloomSize ,BloomSize),
|
||||
|
||||
{ok, Bloom} = ebloom:deserialize(BloomData),
|
||||
{ok, Bloom} = ebloom:deserialize(zlib:unzip(BloomData)),
|
||||
|
||||
%% suck in the root
|
||||
{ok, Root} = read_node(File, RootPos),
|
||||
|
|
|
@ -56,7 +56,7 @@ init([Name,Size]) ->
|
|||
|
||||
{ok, IdxFile} = file:open( fractal_btree_util:index_file_name(Name),
|
||||
[raw, exclusive, write, delayed_write]),
|
||||
{ok, BloomFilter} = ebloom:new(Size, 0.01, 123),
|
||||
{ok, BloomFilter} = ebloom:new(erlang:min(Size,16#ffffffff), 0.01, 123),
|
||||
{ok, #state{ name=Name,
|
||||
index_file_pos=0, index_file=IdxFile,
|
||||
bloom = BloomFilter
|
||||
|
@ -93,7 +93,7 @@ code_change(_OldVsn, State, _Extra) ->
|
|||
|
||||
flush_nodes(#state{ nodes=[], last_node_pos=LastNodePos, bloom=Ref }=State) ->
|
||||
|
||||
Bloom = ebloom:serialize(Ref),
|
||||
Bloom = zlib:zip(ebloom:serialize(Ref)),
|
||||
BloomSize = byte_size(Bloom),
|
||||
|
||||
Trailer = << 0:32, Bloom/binary, BloomSize:32/unsigned, LastNodePos:64/unsigned >>,
|
||||
|
|
|
@ -83,7 +83,7 @@ merge_test() ->
|
|||
ok = fractal_btree_writer:close(BT2),
|
||||
|
||||
|
||||
{Time,{ok,Count}} = timer:tc(fractal_btree_merger, merge, ["test1", "test2", "test3", 8]),
|
||||
{Time,{ok,Count}} = timer:tc(fractal_btree_merger, merge, ["test1", "test2", "test3", 10000]),
|
||||
|
||||
error_logger:info_msg("time to merge: ~p/sec (time=~p, count=~p)~n", [1000000/(Time/Count), Time/1000000, Count]),
|
||||
|
||||
|
|
Loading…
Reference in a new issue