Geometry Nodes: use xxhash for compute context hash
Previously, md5 was used which is significantly slower. In almost all cases this does not have a significant performance impact in practice. However, it's possible to build geometry nodes setups that become a few percent faster ( by combining lots of cheap node groups). Using xxhash instead of md5 should never be slower. Pull Request: https://projects.blender.org/blender/blender/pulls/120225
This commit is contained in:
@@ -401,6 +401,7 @@ set(SRC
|
||||
set(LIB
|
||||
PUBLIC bf::dna
|
||||
PRIVATE bf::extern::fmtlib
|
||||
PRIVATE bf::extern::xxhash
|
||||
bf_intern_eigen
|
||||
PRIVATE bf::intern::guardedalloc
|
||||
extern_wcwidth
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_compute_context.hh"
|
||||
#include "BLI_hash_md5.hh"
|
||||
|
||||
#include <sstream>
|
||||
#include <xxhash.h>
|
||||
|
||||
namespace blender {
|
||||
|
||||
@@ -15,7 +16,9 @@ void ComputeContextHash::mix_in(const void *data, int64_t len)
|
||||
memcpy(buffer, this, HashSizeInBytes);
|
||||
memcpy(buffer + HashSizeInBytes, data, len);
|
||||
|
||||
BLI_hash_md5_buffer(buffer, HashSizeInBytes + len, this);
|
||||
const XXH128_hash_t hash = XXH3_128bits(buffer, len);
|
||||
memcpy(this, &hash, sizeof(hash));
|
||||
static_assert(sizeof(ComputeContextHash) == sizeof(hash));
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &stream, const ComputeContextHash &hash)
|
||||
|
||||
Reference in New Issue
Block a user