Skip to content

Commit

Permalink
Tune the input for the hash (#542)
Browse files Browse the repository at this point in the history
Profiling TreeSheets shows that hashing the entire image data
takes up a lot of time.

This commit tweaks this by just hashing a specific chunk of the image
data at its beginning.
  • Loading branch information
tobiolo authored Oct 14, 2023
1 parent 50e1fad commit f8bacf7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,9 @@ struct System {
}

int AddImageToList(double sc, vector<uint8_t> &&idv, char iti) {
auto hash = FNV1A64(idv);
int max = 4096;
auto subvector = vector<uint8_t>(idv.begin(), idv.begin() + min(idv.size(), max));
auto hash = FNV1A64(subvector);
loopv(i, imagelist) {
if (imagelist[i]->hash == hash) return i;
}
Expand Down

0 comments on commit f8bacf7

Please sign in to comment.