Switch to an unordered_map as a micro-optimization.
This commit is contained in:
parent
f8452ff501
commit
90638c6806
|
@ -4,7 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Hash.h"
|
||||
|
||||
// m_components
|
||||
enum
|
||||
|
@ -87,6 +87,20 @@ struct PortableVertexDeclaration
|
|||
}
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template <>
|
||||
struct hash<PortableVertexDeclaration>
|
||||
{
|
||||
size_t operator()(const PortableVertexDeclaration& decl) const
|
||||
{
|
||||
return HashFletcher((u8 *) &decl, sizeof(decl));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// The implementation of this class is specific for GL/DX, so NativeVertexFormat.cpp
|
||||
// is in the respective backend, not here in VideoCommon.
|
||||
|
||||
|
|
|
@ -1051,4 +1051,4 @@ NativeVertexFormat* VertexLoader::GetNativeVertexFormat()
|
|||
|
||||
}
|
||||
|
||||
std::map<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>> VertexLoader::s_native_vertex_map;
|
||||
std::unordered_map<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>> VertexLoader::s_native_vertex_map;
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
// Metroid Prime: P I16-flt N I16-s16 T0 I16-u16 T1 i16-flt
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/x64Emitter.h"
|
||||
|
@ -141,7 +141,7 @@ private:
|
|||
int m_numLoadedVertices;
|
||||
|
||||
NativeVertexFormat* m_native_vertex_format;
|
||||
static std::map<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>> s_native_vertex_map;
|
||||
static std::unordered_map<PortableVertexDeclaration, std::unique_ptr<NativeVertexFormat>> s_native_vertex_map;
|
||||
|
||||
void SetVAT(const VAT& vat);
|
||||
|
||||
|
|
Loading…
Reference in New Issue