Experiment with temporary us eof ETS table
Rather than expensive lists:ukeymerge, try use a temporary ETS table.
This commit is contained in:
parent
8ccd02e893
commit
2a106d0dc5
1 changed files with 10 additions and 8 deletions
|
@ -102,14 +102,16 @@ check_index(Hash, L0Index) ->
|
||||||
|
|
||||||
to_list(Slots, FetchFun) ->
|
to_list(Slots, FetchFun) ->
|
||||||
SW = os:timestamp(),
|
SW = os:timestamp(),
|
||||||
SlotList = lists:reverse(lists:seq(1, Slots)),
|
Tab = ets:new(temp_l0, [private, ordered_set]),
|
||||||
FullList = lists:foldl(fun(Slot, Acc) ->
|
SlotList = lists:seq(1, Slots),
|
||||||
|
lists:foreach(fun(Slot) ->
|
||||||
Tree = FetchFun(Slot),
|
Tree = FetchFun(Slot),
|
||||||
L = leveled_skiplist:to_list(Tree),
|
L = leveled_skiplist:to_list(Tree),
|
||||||
lists:ukeymerge(1, Acc, L)
|
ets:insert(Tab, L)
|
||||||
end,
|
end,
|
||||||
[],
|
|
||||||
SlotList),
|
SlotList),
|
||||||
|
FullList = ets:tab2list(Tab),
|
||||||
|
true = ets:delete(Tab),
|
||||||
leveled_log:log_timer("PM002", [length(FullList)], SW),
|
leveled_log:log_timer("PM002", [length(FullList)], SW),
|
||||||
FullList.
|
FullList.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue