Update src/leveled_pmem.erl
Simple change to check for presence of objetc in list before adding it: ```Head check took 124416 microseconds checking list of length 5000 Head check took 130114 microseconds checking list of length 5000 Check for presence of repeated objects Head check took 1725 microseconds checking list of length 5```
This commit is contained in:
parent
e73f48a18b
commit
b38d845c3a
1 changed files with 6 additions and 1 deletions
|
@ -200,7 +200,12 @@ merge_trees(StartKey, EndKey, TreeList, LevelMinus1) ->
|
|||
find_pos(<<>>, _Hash, PosList, _SlotID) ->
|
||||
PosList;
|
||||
find_pos(<<1:1/integer, Hash:23/integer, T/binary>>, Hash, PosList, SlotID) ->
|
||||
find_pos(T, Hash, PosList ++ [SlotID], SlotID);
|
||||
case lists:member(SlotID, PosList) of
|
||||
true ->
|
||||
find_pos(T, Hash, PosList, SlotID);
|
||||
false ->
|
||||
find_pos(T, Hash, PosList ++ [SlotID], SlotID)
|
||||
end;
|
||||
find_pos(<<1:1/integer, _Miss:23/integer, T/binary>>, Hash, PosList, SlotID) ->
|
||||
find_pos(T, Hash, PosList, SlotID);
|
||||
find_pos(<<0:1/integer, NxtSlot:7/integer, T/binary>>, Hash, PosList, _SlotID) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue