Investigate performance regression
Performance has regressed following the hashtable change. Speculation that the hashtable format might not be right, and so there is more cycling around the hashtree. Logging added.
This commit is contained in:
parent
52499170c0
commit
8f775a88fd
2 changed files with 24 additions and 7 deletions
|
@ -1092,9 +1092,14 @@ read_integerpairs(<<Int1:32, Int2:32, Rest/binary>>, Pairs) ->
|
||||||
%% false - don't check the CRC before returning key & value
|
%% false - don't check the CRC before returning key & value
|
||||||
%% loose_presence - confirm that the hash of the key is present
|
%% loose_presence - confirm that the hash of the key is present
|
||||||
|
|
||||||
search_hash_table(_Handle, [], _Hash, _Key, _QuickCheck) ->
|
search_hash_table(Handle, Entries, Hash, Key, QuickCheck) ->
|
||||||
|
search_hash_table(Handle, Entries, Hash, Key, QuickCheck, 0).
|
||||||
|
|
||||||
|
search_hash_table(_Handle, [], _Hash, _Key, _QuickCheck, CycleCount) ->
|
||||||
|
log_cyclecount(CycleCount),
|
||||||
missing;
|
missing;
|
||||||
search_hash_table(Handle, [Entry|RestOfEntries], Hash, Key, QuickCheck) ->
|
search_hash_table(Handle, [Entry|RestOfEntries], Hash, Key,
|
||||||
|
QuickCheck, CycleCount) ->
|
||||||
{ok, _} = file:position(Handle, Entry),
|
{ok, _} = file:position(Handle, Entry),
|
||||||
{StoredHash, DataLoc} = read_next_2_integers(Handle),
|
{StoredHash, DataLoc} = read_next_2_integers(Handle),
|
||||||
case StoredHash of
|
case StoredHash of
|
||||||
|
@ -1111,15 +1116,26 @@ search_hash_table(Handle, [Entry|RestOfEntries], Hash, Key, QuickCheck) ->
|
||||||
RestOfEntries,
|
RestOfEntries,
|
||||||
Hash,
|
Hash,
|
||||||
Key,
|
Key,
|
||||||
QuickCheck);
|
QuickCheck,
|
||||||
|
CycleCount + 1);
|
||||||
_ ->
|
_ ->
|
||||||
|
log_cyclecount(CycleCount),
|
||||||
KV
|
KV
|
||||||
end;
|
end;
|
||||||
%0 ->
|
%0 ->
|
||||||
% % Hash is 0 so key must be missing as 0 found before Hash matched
|
% % Hash is 0 so key must be missing as 0 found before Hash matched
|
||||||
% missing;
|
% missing;
|
||||||
_ ->
|
_ ->
|
||||||
search_hash_table(Handle, RestOfEntries, Hash, Key, QuickCheck)
|
search_hash_table(Handle, RestOfEntries, Hash, Key,
|
||||||
|
QuickCheck, CycleCount + 1)
|
||||||
|
end.
|
||||||
|
|
||||||
|
log_cyclecount(CycleCount) ->
|
||||||
|
if
|
||||||
|
CycleCount > 8 ->
|
||||||
|
leveled_log:log("CDB15", [CycleCount]);
|
||||||
|
true ->
|
||||||
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
% Write Key and Value tuples into the CDB. Each tuple consists of a
|
% Write Key and Value tuples into the CDB. Each tuple consists of a
|
||||||
|
|
|
@ -260,9 +260,10 @@
|
||||||
{"CDB13",
|
{"CDB13",
|
||||||
{info, "Write options of ~w"}},
|
{info, "Write options of ~w"}},
|
||||||
{"CDB14",
|
{"CDB14",
|
||||||
{info, "Microsecond imings for hashtree build of "
|
{info, "Microsecond timings for hashtree build of "
|
||||||
++ "to_list ~w sort ~w build ~w"}}
|
++ "to_list ~w sort ~w build ~w"}},
|
||||||
|
{"CDB15",
|
||||||
|
{info, "Cycle count of ~w in hashtable search higher than expected~n"}}
|
||||||
])).
|
])).
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue