Fix Accumulators

Correct inefficient list accumulators
This commit is contained in:
Martin Sumner 2018-05-02 00:23:26 +01:00
parent 82a1449447
commit 0185b3aa7d
2 changed files with 4 additions and 4 deletions

View file

@ -175,7 +175,7 @@ aae_bustedjournal(_Config) ->
testutil:corrupt_journal(RootPath, HeadF, 1000, 2048, 1000),
{ok, Bookie2} = leveled_bookie:book_start(StartOpts),
FoldKeysFun = fun(B, K, Acc) -> Acc ++ [{B, K}] end,
FoldKeysFun = fun(B, K, Acc) -> [{B, K}|Acc] end,
AllKeyQuery = {keylist, o_rkv, {FoldKeysFun, []}},
{async, KeyF} = leveled_bookie:book_returnfolder(Bookie2, AllKeyQuery),
KeyList = KeyF(),

View file

@ -596,12 +596,12 @@ get_randomdate() ->
[Year, Month, Day, Hour, Minute, Second])).
foldkeysfun(_Bucket, Item, Acc) -> Acc ++ [Item].
foldkeysfun(_Bucket, Item, Acc) -> [Item|Acc].
foldkeysfun_returnbucket(Bucket, {Term, Key}, Acc) ->
Acc ++ [{Term, {Bucket, Key}}];
[{Term, {Bucket, Key}}|Acc];
foldkeysfun_returnbucket(Bucket, Key, Acc) ->
Acc ++ [{Bucket, Key}].
[{Bucket, Key}|Acc].
check_indexed_objects(Book, B, KSpecL, V) ->
% Check all objects match, return what should be the results of an all