Use xxHash instead of CityHash, it's faster.

At least on Windows it's definitely got the edge.
This commit is contained in:
Unknown W. Brackets 2013-08-16 23:02:29 -07:00
parent 5acbbe705f
commit 52f1de8f1d
2 changed files with 7 additions and 7 deletions

View File

@ -26,6 +26,7 @@
#include "GPU/GLES/Framebuffer.h"
#include "Core/Config.h"
#include "ext/xxhash.h"
#include "native/ext/cityhash/city.h"
#ifdef _M_SSE
@ -892,9 +893,7 @@ void TextureCache::UpdateCurrentClut() {
// If not, we're going to hash random data, which hopefully doesn't cause a performance issue.
const u32 clutExtendedBytes = clutTotalBytes_ + clutBaseBytes;
// QuickClutHash is not quite good enough apparently.
// clutHash_ = QuickClutHash((const u8 *)clutBufRaw_, clutExtendedBytes);
clutHash_ = CityHash32((const char *)clutBufRaw_, clutExtendedBytes);
clutHash_ = XXH32((const char *)clutBufRaw_, clutExtendedBytes, 0xC0108888);
// Avoid a copy when we don't need to convert colors.
if (clutFormat != GE_CMODE_32BIT_ABGR8888) {

View File

@ -27,6 +27,7 @@
#include "native/gfx_es2/gl_state.h"
#include "native/ext/cityhash/city.h"
#include "ext/xxhash.h"
#include "GPU/Math3D.h"
#include "GPU/GPUState.h"
@ -1034,14 +1035,14 @@ u32 TransformDrawEngine::ComputeHash() {
// It is really very expensive to check all the vertex data so often.
for (int i = 0; i < numDrawCalls; i++) {
if (!drawCalls[i].inds) {
fullhash += CityHash32((const char *)drawCalls[i].verts, vertexSize * drawCalls[i].vertexCount);
fullhash += XXH32((const char *)drawCalls[i].verts, vertexSize * drawCalls[i].vertexCount, 0x1DE8CAC4);
} else {
// This could get seriously expensive with sparse indices. Need to combine hashing ranges the same way
// we do when drawing.
fullhash += CityHash32((const char *)drawCalls[i].verts + vertexSize * drawCalls[i].indexLowerBound,
vertexSize * (drawCalls[i].indexUpperBound - drawCalls[i].indexLowerBound));
fullhash += XXH32((const char *)drawCalls[i].verts + vertexSize * drawCalls[i].indexLowerBound,
vertexSize * (drawCalls[i].indexUpperBound - drawCalls[i].indexLowerBound), 0x029F3EE1);
int indexSize = (dec_->VertexType() & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_16BIT ? 2 : 1;
fullhash += CityHash32((const char *)drawCalls[i].inds, indexSize * drawCalls[i].vertexCount);
fullhash += XXH32((const char *)drawCalls[i].inds, indexSize * drawCalls[i].vertexCount, 0x955FD1CA);
}
}